add hint block

This commit is contained in:
Glease committed 2021-05-17 07:44:45 +08:00
1 parent 25971904a6
commit bee6ce337b
23 files changed
+235 -51

No files matched your search

@@ -1,9 +1,14 @@
package com.gtnewhorizon.structurelib;
import com.gtnewhorizon.structurelib.block.BlockHint;
import com.gtnewhorizon.structurelib.item.ItemBlockHint;
import com.gtnewhorizon.structurelib.proxy.CommonProxy;
import com.gtnewhorizon.structurelib.util.XSTR;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -15,4 +20,11 @@ public class StructureLib {
@SidedProxy(serverSide = "com.gtnewhorizon.structurelib.proxy.CommonProxy", clientSide = "com.gtnewhorizon.structurelib.proxy.ClientProxy")
public static CommonProxy proxy;
public static final XSTR RANDOM = new XSTR();
public static Block blockHint;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
GameRegistry.registerBlock(blockHint = new BlockHint(), ItemBlockHint.class, "blockhint");
}
}
@@ -0,0 +1,66 @@
package com.gtnewhorizon.structurelib.block;
import com.gtnewhorizon.structurelib.StructureLib;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import java.util.List;
public class BlockHint extends Block {
private static final IIcon[] hint = new IIcon[16];
public BlockHint() {
super(Material.iron);
setBlockName("structurelib.blockhint");
setCreativeTab(CreativeTabs.tabBlock);
}
@Override
public void registerBlockIcons(IIconRegister aIconRegister) {
//super.registerBlockIcons(aIconRegister);
hint[0] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_0");
hint[1] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_1");
hint[2] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_2");
hint[3] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_3");
hint[4] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_4");
hint[5] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_5");
hint[6] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_6");
hint[7] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_7");
hint[8] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_8");
hint[9] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_9");
hint[10] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_10");
hint[11] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_11");
hint[12] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_DEFAULT");
hint[13] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_AIR");
hint[14] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_NOAIR");
hint[15] = aIconRegister.registerIcon(StructureLib.MOD_ID + ":iconsets/HINT_ERROR");
}
@Override
public IIcon getIcon(int aSide, int aMeta) {
return hint[aMeta];
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) {
int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
return getIcon(aSide, tMeta);
}
@Override
@SuppressWarnings("unchecked")
public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
for (int i = 0; i <= 15; i++) {
aList.add(new ItemStack(aItem, 1, i));
}
}
}
@@ -0,0 +1,66 @@
package com.gtnewhorizon.structurelib.item;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.util.List;
import static net.minecraft.util.StatCollector.translateToLocal;
public class ItemBlockHint extends ItemBlock {
public ItemBlockHint(Block p_i45328_1_) {
super(p_i45328_1_);
setMaxDamage(0);
setHasSubtypes(true);
setCreativeTab(CreativeTabs.tabBlock);
}
@Override
@SuppressWarnings("unchecked")
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
aList.add(translateToLocal("structurelib.blockhint.desc.0"));//Helps while building
switch (aStack.getItemDamage()) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("structurelib.blockhint.desc.1"));//Placeholder for a certain group.
break;
case 12:
aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("structurelib.blockhint.desc.2"));//General placeholder.
break;
case 13:
aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("structurelib.blockhint.desc.3"));//Make sure it contains Air material.
break;
case 14:
aList.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("structurelib.blockhint.desc.4"));//Make sure it does not contain Air material.
break;
case 15:
aList.add(EnumChatFormatting.BLUE.toString() + translateToLocal("structurelib.blockhint.desc.5"));//ERROR, what did u expect?
break;
default://WTF?
aList.add("Damn son where did you get that!?");
aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess...");
}
}
public int getMetadata(int aMeta) {
return aMeta;
}
public String getUnlocalizedName(ItemStack aStack) {
return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
}
}
@@ -12,32 +12,35 @@ import static com.gtnewhorizon.structurelib.StructureLib.RANDOM;
public class ClientProxy extends CommonProxy {
@Override
public void hint_particle_tinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) {
Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w, x, y, z, icons).withColorTint(RGBa));
createParticleFX(w, x, y, z);
}
@Override
public void hint_particle_tinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {
Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w, x, y, z, block, meta).withColorTint(RGBa));
createParticleFX(w, x, y, z);
}
@Override
public void hint_particle(World w, int x, int y, int z, IIcon[] icons) {
Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w, x, y, z, icons));
createParticleFX(w, x, y, z);
}
@Override
public void hint_particle(World w, int x, int y, int z, Block block, int meta) {
Minecraft.getMinecraft().effectRenderer.addEffect(new BlockHint(w, x, y, z, block, meta));
createParticleFX(w, x, y, z);
}
private static void createParticleFX(World w, int x, int y, int z) {
EntityFX particle = new WeightlessParticleFX(w, x + RANDOM.nextFloat() * 0.5F, y + RANDOM.nextFloat() * 0.5F, z + RANDOM.nextFloat() * 0.5F, 0, 0, 0);
particle.setRBGColorF(0, 0.6F * RANDOM.nextFloat(), 0.8f);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
@Override
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), RGBa);
}
@Override
public void hintParticle(World w, int x, int y, int z, IIcon[] icons) {
hintParticleTinted(w, x, y, z, icons, new short[]{255, 255, 255, 0});
}
@Override
public void hintParticle(World w, int x, int y, int z, Block block, int meta) {
hintParticleTinted(w, x, y, z, createIIconFromBlock(block, meta), new short[]{255, 255, 255, 0});
}
private static IIcon[] createIIconFromBlock(Block block, int meta) {
IIcon[] ret = new IIcon[6];
for (int i = 0; i < 6; i++) {
block.getIcon(i, meta);
}
return ret;
}
}
@@ -5,8 +5,8 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class CommonProxy {
public void hint_particle_tinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa){}
public void hint_particle_tinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa){}
public void hint_particle(World w,int x, int y, int z, IIcon[] icons){}
public void hint_particle(World w,int x, int y, int z, Block block, int meta){}
public void hintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa){}
public void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa){}
public void hintParticle(World w, int x, int y, int z, IIcon[] icons){}
public void hintParticle(World w, int x, int y, int z, Block block, int meta){}
}
@@ -27,8 +27,6 @@ import static java.lang.Integer.MIN_VALUE;
*/
public class StructureUtility {
private static final String NICE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz=|!@#$%&()[]{};:<>/?_,.*^'`";
// TODO make it an actual block
private static final Block sHintCasingsTT = Blocks.air;
@SuppressWarnings("rawtypes")
private static final Map<Vec3Impl, IStructureNavigate> STEP = new HashMap<>();
@SuppressWarnings("rawtypes")
@@ -40,7 +38,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 13);
StructureLib.proxy.hintParticle(world, x, y, z, StructureLib.blockHint, 13);
return true;
}
@@ -59,13 +57,13 @@ public class StructureUtility {
@Override
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 14);
StructureLib.proxy.hintParticle(world, x, y, z, StructureLib.blockHint, 14);
return true;
}
@Override
public boolean placeBlock(Object o, World world, int x, int y, int z, ItemStack trigger) {
world.setBlock(x, y, z, sHintCasingsTT, 14, 2);
world.setBlock(x, y, z, StructureLib.blockHint, 14, 2);
return true;
}
};
@@ -78,7 +76,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(Object o, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, sHintCasingsTT, 15);
StructureLib.proxy.hintParticle(world, x, y, z, StructureLib.blockHint, 15);
return true;
}
@@ -129,7 +127,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, sHintCasingsTT, meta);
StructureLib.proxy.hintParticle(world, x, y, z, StructureLib.blockHint, meta);
return false;
}
};
@@ -148,7 +146,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, icons.get());
StructureLib.proxy.hintParticle(world, x, y, z, icons.get());
return false;
}
};
@@ -167,7 +165,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle_tinted(world, x, y, z, icons.get(), RGBa);
StructureLib.proxy.hintParticleTinted(world, x, y, z, icons.get(), RGBa);
return false;
}
};
@@ -193,7 +191,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
StructureLib.proxy.hintParticle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
@@ -220,7 +218,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
StructureLib.proxy.hintParticle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
@@ -239,7 +237,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
StructureLib.proxy.hintParticle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
@@ -262,7 +260,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
StructureLib.proxy.hintParticle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
@@ -291,7 +289,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -311,7 +309,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -346,7 +344,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -366,7 +364,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -393,7 +391,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -413,7 +411,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -442,7 +440,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -461,7 +459,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -510,7 +508,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -530,7 +528,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, defaultBlock, defaultMeta);
StructureLib.proxy.hintParticle(world, x, y, z, defaultBlock, defaultMeta);
return true;
}
};
@@ -538,7 +536,7 @@ public class StructureUtility {
}
public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, int dots) {
return ofBlockAdder(iBlockAdder, sHintCasingsTT, dots - 1);
return ofBlockAdder(iBlockAdder, StructureLib.blockHint, dots - 1);
}
public static <T> IStructureElementNoPlacement<T> ofTileAdder(ITileAdder<T> iTileAdder, Block hintBlock, int hintMeta) {
@@ -555,7 +553,7 @@ public class StructureUtility {
@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLib.proxy.hint_particle(world, x, y, z, hintBlock, hintMeta);
StructureLib.proxy.hintParticle(world, x, y, z, hintBlock, hintMeta);
return true;
}
};
@@ -0,0 +1,39 @@
tile.structurelib.blockhint.0.name=Hint 1 dot
tile.structurelib.blockhint.1.name=Hint 2 dots
tile.structurelib.blockhint.2.name=Hint 3 dots
tile.structurelib.blockhint.3.name=Hint 4 dots
tile.structurelib.blockhint.4.name=Hint 5 dots
tile.structurelib.blockhint.5.name=Hint 6 dots
tile.structurelib.blockhint.6.name=Hint 7 dots
tile.structurelib.blockhint.7.name=Hint 8 dots
tile.structurelib.blockhint.8.name=Hint 9 dots
tile.structurelib.blockhint.9.name=Hint 10 dots
tile.structurelib.blockhint.10.name=Hint 11 dots
tile.structurelib.blockhint.11.name=Hint 12 dots
tile.structurelib.blockhint.12.name=Hint general
tile.structurelib.blockhint.13.name=Hint air
tile.structurelib.blockhint.14.name=Hint no air
tile.structurelib.blockhint.15.name=Hint error
structurelib.blockhint.desc.0=Helps while building
structurelib.blockhint.0.name=Hint 1 dot
structurelib.blockhint.1.name=Hint 2 dot
structurelib.blockhint.2.name=Hint 3 dot
structurelib.blockhint.3.name=Hint 4 dot
structurelib.blockhint.4.name=Hint 5 dot
structurelib.blockhint.5.name=Hint 6 dot
structurelib.blockhint.6.name=Hint 7 dot
structurelib.blockhint.7.name=Hint 8 dot
structurelib.blockhint.8.name=Hint 9 dot
structurelib.blockhint.9.name=Hint 10 dot
structurelib.blockhint.10.name=Hint 11 dot
structurelib.blockhint.11.name=Hint 12 dot
structurelib.blockhint.desc.1=Placeholder for a certain group.
structurelib.blockhint.12.name=Hint general
structurelib.blockhint.desc.2=General placeholder.
structurelib.blockhint.13.name=Hint air
structurelib.blockhint.desc.3=Make sure it contains Air material.
structurelib.blockhint.14.name=Hint no air
structurelib.blockhint.desc.4=Make sure it does not contain Air material.
structurelib.blockhint.15.name=Hint error
structurelib.blockhint.desc.5=ERROR, what did u expect?
Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B