#1266 Paintable blocks not repaintable

The PainterTemplate classes were defined as static, this removes that
and instead opts to call the container class's instance, for example
BlockPaintedFence.this. This allows for the PainterTemplate to not fear
having a null reference to its container by being able to directly
reference it. The only area where this had any effect was in
ConduitRecipes and was easily resolved.
This commit is contained in:
tterrag1098 committed 2014-11-18 17:37:42 -05:00
1 parent 6b32bd73d7
commit bab1978188
10 files changed
+27 -28

No files matched your search

@@ -12,7 +12,6 @@ import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadePainterRecipe;
import crazypants.enderio.conduit.item.filter.ClearFilterRecipe;
import crazypants.enderio.conduit.item.filter.CopyFilterRecipe;
import crazypants.enderio.conduit.me.MEUtil;
@@ -64,7 +63,7 @@ public class ConduitRecipes {
ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0);
GameRegistry.addShapedRecipe(itemConduit, "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedIronNugget);
MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, new FacadePainterRecipe());
MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe());
//Filter Recipes
ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0);
@@ -126,16 +126,12 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider
TooltipAddera.addDetailedTooltipFromResources(list, itemstack);
}
public static final class FacadePainterRecipe extends BasicPainterTemplate {
public FacadePainterRecipe() {
}
public final class FacadePainterRecipe extends BasicPainterTemplate {
@Override
public boolean isValidTarget(ItemStack target) {
return target != null && target.getItem() == EnderIO.itemConduitFacade;
return target != null && target.getItem() == ItemConduitFacade.this;
}
}
}
@@ -230,10 +230,10 @@ public class BlockPaintedCarpet extends BlockCarpet implements ITileEntityProvid
return 0; // need to do custom dropping to maintain source metadata
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
super(Blocks.carpet);
super(Blocks.carpet, BlockPaintedCarpet.this);
}
@Override
@@ -264,10 +264,10 @@ public class BlockPaintedFence extends BlockFence implements ITileEntityProvider
return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false;
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
super(Blocks.fence, Blocks.nether_brick_fence, EnderIO.blockPaintedFence);
super(Blocks.fence, Blocks.nether_brick_fence, BlockPaintedFence.this);
}
@Override
@@ -231,10 +231,10 @@ public class BlockPaintedFenceGate extends BlockFenceGate implements ITileEntity
return 0; // need to do custom dropping to maintain source metadata
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
super(Blocks.fence_gate, Blocks.nether_brick_fence, EnderIO.blockPaintedFenceGate);
super(Blocks.fence_gate, Blocks.nether_brick_fence, BlockPaintedFenceGate.this);
}
@Override
@@ -63,7 +63,7 @@ public class BlockPaintedGlowstone extends Block implements ITileEntityProvider,
private void init() {
GameRegistry.registerBlock(this, BlockItemPaintedGlowstone.class, ModObject.blockPaintedGlowstone.unlocalisedName);
GameRegistry.registerTileEntity(TileEntityPaintedBlock.class, ModObject.blockPaintedGlowstone.unlocalisedName + "TileEntity");
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate(this));
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate());
}
public static ItemStack createItemStackForSourceBlock(Block block, int damage) {
@@ -244,10 +244,10 @@ public class BlockPaintedGlowstone extends Block implements ITileEntityProvider,
return renderId;
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate(Block paintedGlowstone) {
super(Blocks.glowstone, paintedGlowstone);
public PainterTemplate() {
super(Blocks.glowstone, BlockPaintedGlowstone.this);
MinecraftForge.EVENT_BUS.register(this);
}
@@ -239,10 +239,10 @@ public class BlockPaintedSlab extends BlockSlab implements ITileEntityProvider,
return 0; // need to do custom dropping to maintain source metadata
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
super(Blocks.wooden_slab, Blocks.stone_slab, EnderIO.blockPaintedDoubleSlab, EnderIO.blockPaintedSlab);
super(Blocks.wooden_slab, Blocks.stone_slab, EnderIO.blockPaintedDoubleSlab, BlockPaintedSlab.this);
}
@Override
@@ -237,10 +237,7 @@ public class BlockPaintedStair extends BlockStairs implements ITileEntityProvide
return 0; // need to do custom dropping to maintain source metadata
}
public static final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
}
public final class PainterTemplate extends BasicPainterTemplate {
@Override
public ResultStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) {
@@ -238,10 +238,10 @@ public class BlockPaintedWall extends BlockWall implements ITileEntityProvider,
return 0; // need to do custom dropping to maintain source metadata
}
public static final class PainterTemplate extends BasicPainterTemplate {
public final class PainterTemplate extends BasicPainterTemplate {
public PainterTemplate() {
super(Blocks.cobblestone_wall, EnderIO.blockPaintedWall);
super(Blocks.cobblestone_wall, BlockPaintedWall.this);
}
@Override
@@ -3,6 +3,7 @@ package crazypants.enderio.material;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -36,6 +37,12 @@ public class ItemFusedQuartzFrame extends Item {
GameRegistry.registerItem(this, ModObject.itemFusedQuartzFrame.unlocalisedName);
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new FramePainterRecipe(this));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
list.add(PainterUtil.applyDefaultPaintedState(new ItemStack(item)));
}
@Override
public void registerIcons(IIconRegister IIconRegister) {
@@ -78,7 +85,7 @@ public class ItemFusedQuartzFrame extends Item {
list.add(PainterUtil.getTooltTipText(item));
}
public static final class FramePainterRecipe extends BasicPainterTemplate {
public final class FramePainterRecipe extends BasicPainterTemplate {
private ItemFusedQuartzFrame i;