mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-12 00:17:47 +00:00
1 parent
d062956186
commit
f2080ab8b4
7 files changed
+22
-91
No files matched your search
@@ -1,9 +1,18 @@
|
||||
package com.colen.postea;
|
||||
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.core.Api;
|
||||
import com.colen.postea.API.BlockReplacementManager;
|
||||
import com.colen.postea.API.TileEntityReplacementManager;
|
||||
import com.colen.postea.API.TileTransformer;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import gregtech.api.GregTech_API;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -14,20 +23,21 @@ public class Postea {
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
//ItemStackReplacementManager.addItemReplacement(Item.getItemFromBlock(Blocks.grass), 0, Item.getItemFromBlock(Blocks.coal_ore), 10);
|
||||
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 6, Blocks.emerald_ore, 0);
|
||||
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 16022, Blocks.nether_brick, 0);
|
||||
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 1018, Blocks.end_stone, 0);
|
||||
BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 6, Blocks.emerald_ore, 0);
|
||||
BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 16022, Blocks.nether_brick, 0);
|
||||
BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 1018, Blocks.end_stone, 0);
|
||||
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
// Define the transformation function
|
||||
Function<NBTTagCompound, NBTTagCompound> myTransformer = (tag) -> {
|
||||
return tag;
|
||||
};
|
||||
|
||||
// TileEntityReplacementManager.tileEntityReplacement("GT_TileEntity_Ores", new TileTransformer(TileEntityChest.class, myTransformer));
|
||||
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 0, Blocks.chest, 0);
|
||||
TileEntityReplacementManager.tileEntityReplacement("GT_TileEntity_Ores", new TileTransformer(TileEntityChest.class, myTransformer));
|
||||
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 0, Blocks.chest, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.colen.postea.mixins;
|
||||
|
||||
import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public interface IGameDataAccessor {
|
||||
FMLControlledNamespacedRegistry<Block> getIBlockRegistry();
|
||||
FMLControlledNamespacedRegistry<Item> getIItemRegistry();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public final class PosteaLoadingPlugin implements IEarlyMixinLoader, IFMLLoading
|
||||
|
||||
@Override
|
||||
public String getMixinConfig() {
|
||||
return "mixins.postea.json";
|
||||
return "mixins.postea.early.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,6 @@ public final class PosteaLoadingPlugin implements IEarlyMixinLoader, IFMLLoading
|
||||
mixins.add("MixinChunkProviderServer");
|
||||
mixins.add("MixinAnvilChunkLoader");
|
||||
mixins.add("MixinTileEntity");
|
||||
mixins.add("MixinGameData");
|
||||
|
||||
return mixins;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ public class MixinTileEntity {
|
||||
|
||||
|
||||
/**
|
||||
* @author Colen
|
||||
* @reason Stuff
|
||||
* Creates a new entity and loads its data from the specified NBT.
|
||||
*/
|
||||
@Overwrite
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.colen.postea.mixins.late;
|
||||
|
||||
import com.colen.postea.mixins.IGameDataAccessor;
|
||||
import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
@Mixin(GameData.class)
|
||||
public class MixinGameData implements IGameDataAccessor {
|
||||
|
||||
@Unique
|
||||
protected native static GameData getMain();
|
||||
@Shadow(remap = false)
|
||||
private static FMLControlledNamespacedRegistry<Block> iBlockRegistry;
|
||||
@Shadow(remap = false)
|
||||
private static FMLControlledNamespacedRegistry<Item> iItemRegistry;
|
||||
|
||||
@Override
|
||||
public FMLControlledNamespacedRegistry<Block> getIBlockRegistry() {
|
||||
return iBlockRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FMLControlledNamespacedRegistry<Item> getIItemRegistry() {
|
||||
return iItemRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Colen
|
||||
* @reason Stuff
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
static Item findItem(String modId, String name) {
|
||||
IGameDataAccessor accessor = (IGameDataAccessor) getMain();
|
||||
return accessor.getIItemRegistry().getObject(modId + ":" + name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Colen
|
||||
* @reason Stuff
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
static Block findBlock(String modId, String name) {
|
||||
String key = "minecraft:bedrock";
|
||||
IGameDataAccessor accessor = (IGameDataAccessor) getMain();
|
||||
return accessor.getIBlockRegistry().containsKey(key) ? accessor.getIBlockRegistry().getObject(key) : null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user