add RUDIMENTARY displays

This commit is contained in:
Sen 2025-07-06 13:20:13 +02:00
parent f6b036b517
commit e18a151f6c
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
31 changed files with 795 additions and 483 deletions

View file

@ -13,7 +13,7 @@ public abstract class BlockContainer extends Block implements ITileEntityProvide
this.hasTile = true;
}
protected boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
private boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) {
return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.BLOCKING;
}

View file

@ -0,0 +1,153 @@
package common.block.tech;
import common.block.BlockContainer;
import common.block.Material;
import common.block.Rotatable;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.item.CheatTab;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.properties.Property;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityDisplay;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
public class BlockDisplay extends BlockContainer implements Rotatable
{
public BlockDisplay()
{
super(Material.SOLID);
float f = 0.25F;
float f1 = 1.0F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
this.setTab(CheatTab.TECHNOLOGY);
}
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
{
State iblockstate = worldIn.getState(pos);
if (iblockstate.getBlock() == this)
{
float f = 0.0625F;
switch (iblockstate.getValue(FACING))
{
case NORTH:
this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
break;
case SOUTH:
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
break;
case WEST:
this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
case EAST:
default:
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
}
}
protected Property[] getProperties()
{
return new Property[] {FACING};
}
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
{
this.setBlockBoundsBasedOnState(worldIn, pos);
return super.getCollisionBoundingBox(worldIn, pos, state);
}
public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos)
{
this.setBlockBoundsBasedOnState(worldIn, pos);
return super.getSelectedBoundingBox(worldIn, pos);
}
public boolean isFullCube()
{
return false;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Return true if an entity can be spawned inside the block (used to get the player's bed spawn location)
*/
public boolean canSpawnInBlock()
{
return true;
}
/**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/
public TileEntity createNewTileEntity(World worldIn)
{
return new TileEntityDisplay();
}
public boolean isXrayVisible()
{
return true;
}
public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
return this.getState().withProperty(FACING, facing.getAxis().isVertical() ? placer.getHorizontalFacing() : facing);
}
public int getRenderType() {
return 3;
}
public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side)
{
return true;
}
//
// public Transforms getTransform() {
// return Transforms.LAYER;
// }
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("iron_block").add(0, 0, 15, 16, 16, 16).n().noCull().s().du().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
}
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
{
if (!worldIn.client)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityDisplay display)
{
display.setPixel(1, 12, 0xff0000);
display.setPixel(2, 12, 0x00ff00);
display.setPixel(3, 12, 0x0000ff);
display.markDirty();
worldIn.markBlockForUpdate(pos);
}
}
return true;
}
}

View file

@ -8,6 +8,7 @@ import common.model.ParticleType;
import common.tags.TagObject;
import common.util.ExtMath;
import common.world.AWorldClient;
import common.world.AWorldServer;
import common.world.World;
public class EntityFireworks extends Entity
@ -143,6 +144,7 @@ public class EntityFireworks extends Entity
{
this.worldObj.setEntityState(this, (byte)17);
this.setDead();
this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 3.0f, false, false, false);
}
}

View file

@ -12,260 +12,150 @@ import common.rng.Random;
import common.util.BlockPos;
import common.world.World;
public class EntityArachnoid extends EntityNPC
{
public EntityArachnoid(World worldIn)
{
super(worldIn);
// this.setSize(1.4F, 1.6F);
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
// this.tasks.addTask(4, new AISpiderAttack(this, EntityNPC.class));
this.tasks.addTask(4, new AISpiderAttack(this, EntityNPC.class));
// this.targets.addTask(2, new EntitySpider.AISpiderTarget(this, EntityNPC.class));
// this.targets.addTask(3, new EntitySpider.AISpiderTarget(this, EntityNPC.class));
}
// public double getMountedYOffset()
// {
// return (double)(this.height * 0.5F);
// }
// public float getRenderScale()
// {
// return 0.9375f * this.height / 1.6f;
// }
protected PathNavigate getNewNavigator(World worldIn)
{
return new PathNavigateClimber(this, worldIn);
}
public class EntityArachnoid extends EntityNPC {
static class AISpiderAttack extends EntityAIAttackOnCollide {
public AISpiderAttack(EntityArachnoid spider, Class<? extends Entity> targetClass) {
super(spider, targetClass, 1.0D, true);
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(23, (byte)0);
}
public void onUpdate()
{
super.onUpdate();
public boolean continueExecuting() {
float f = this.attacker.getBrightness(1.0F);
if (!this.worldObj.client)
{
this.setBesideClimbableBlock(this.collidedHorizontally);
}
}
if(f >= 0.5F && this.attacker.getRNG().chance(100)) {
this.attacker.setAttackTarget((EntityLiving)null);
return false;
}
else {
return super.continueExecuting();
}
}
// protected void applyEntityAttributes()
// {
// super.applyEntityAttributes();
// this.getEntityAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D);
// }
// protected String getLivingSound()
// {
// return "mob.spider.say";
// }
public boolean isOnLadder()
{
return super.isOnLadder() || (this.client != null ? this.collidedHorizontally && !this.noclip : this.isBesideClimbableBlock());
}
public void setInWeb()
{
}
public boolean isBesideClimbableBlock()
{
return (!this.isPlayer() || !this.noclip) && this.dataWatcher.getWatchableObjectByte(23) != 0;
}
public void setBesideClimbableBlock(boolean climb)
{
this.dataWatcher.updateObject(23, (byte)(climb ? 1 : 0));
}
public Object onInitialSpawn(Object livingdata)
{
livingdata = super.onInitialSpawn(livingdata);
// if(!this.isChild()) {
// if (this.worldObj.rand.chance(100))
// {
// EntityUndead entityskeleton = new EntityUndead(this.worldObj);
// entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, 0.0F);
// entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null);
// this.worldObj.spawnEntityInWorld(entityskeleton);
// entityskeleton.mountEntity(this);
// }
if (livingdata == null && !this.isPlayer())
{
livingdata = new EntityArachnoid.GroupData(this.worldObj.rand.chance(40));
protected double getAttackRange(EntityLiving attackTarget) {
return (double)(4.0F + attackTarget.width);
}
}
if (/* this.worldObj.getDifficulty() == Difficulty.HARD && */ this.worldObj.rand.chance())
{
((EntityArachnoid.GroupData)livingdata).pickEffect(this.worldObj.rand);
}
}
public static class GroupData {
public Potion potionEffectId;
public boolean isChild;
if (livingdata instanceof EntityArachnoid.GroupData)
{
Potion i = ((EntityArachnoid.GroupData)livingdata).potionEffectId;
public GroupData(boolean isChild) {
this.isChild = isChild;
}
if (i != null)
{
this.addEffect(new PotionEffect(i, Integer.MAX_VALUE, 0));
}
if(((EntityArachnoid.GroupData)livingdata).isChild)
this.setGrowingAge(-24000);
}
// }
return livingdata;
}
public void pickEffect(Random rand) {
this.potionEffectId = rand.pick(Potion.SPEED, Potion.SPEED, Potion.STRENGTH, Potion.REGENERATION);
}
}
public EntityArachnoid(World worldIn) {
super(worldIn);
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
this.tasks.addTask(4, new AISpiderAttack(this, EntityNPC.class));
}
protected PathNavigate getNewNavigator(World worldIn) {
return new PathNavigateClimber(this, worldIn);
}
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(23, (byte)0);
}
public void onUpdate() {
super.onUpdate();
if(!this.worldObj.client) {
this.setBesideClimbableBlock(this.collidedHorizontally);
}
}
public boolean isOnLadder() {
return super.isOnLadder() || (this.client != null ? this.collidedHorizontally && !this.noclip : this.isBesideClimbableBlock());
}
public void setInWeb() {
}
public boolean isBesideClimbableBlock() {
return (!this.isPlayer() || !this.noclip) && this.dataWatcher.getWatchableObjectByte(23) != 0;
}
public void setBesideClimbableBlock(boolean climb) {
this.dataWatcher.updateObject(23, (byte)(climb ? 1 : 0));
}
public Object onInitialSpawn(Object livingdata) {
livingdata = super.onInitialSpawn(livingdata);
if(livingdata == null && !this.isPlayer()) {
livingdata = new EntityArachnoid.GroupData(this.worldObj.rand.chance(40));
if(this.worldObj.rand.chance()) {
((EntityArachnoid.GroupData)livingdata).pickEffect(this.worldObj.rand);
}
}
if(livingdata instanceof EntityArachnoid.GroupData) {
Potion i = ((EntityArachnoid.GroupData)livingdata).potionEffectId;
if(i != null) {
this.addEffect(new PotionEffect(i, Integer.MAX_VALUE, 0));
}
if(((EntityArachnoid.GroupData)livingdata).isChild)
this.setGrowingAge(-24000);
}
return livingdata;
}
public boolean isSneakingVisually() {
return false;
}
// public float getEyeHeight()
// {
// return super.getEyeHeight() * 0.85f;
// }
public boolean isSneakingVisually() {
return false;
}
public int getColor() {
return 0xc63ba0;
}
static class AISpiderAttack extends EntityAIAttackOnCollide
{
public AISpiderAttack(EntityArachnoid spider, Class <? extends Entity > targetClass)
{
super(spider, targetClass, 1.0D, true);
}
public boolean continueExecuting()
{
float f = this.attacker.getBrightness(1.0F);
if (f >= 0.5F && this.attacker.getRNG().chance(100))
{
this.attacker.setAttackTarget((EntityLiving)null);
return false;
}
else
{
return super.continueExecuting();
}
}
protected double getAttackRange(EntityLiving attackTarget)
{
return (double)(4.0F + attackTarget.width);
}
}
// static class AISpiderTarget<T extends EntityLivingBase> extends EntityAINearestAttackableTarget
// {
// public AISpiderTarget(EntitySpider spider, Class<T> classTarget)
// {
// super(spider, classTarget, true);
// }
//
// public boolean shouldExecute()
// {
// float f = this.taskOwner.getBrightness(1.0F);
// return f >= 0.5F ? false : super.shouldExecute();
// }
// }
// public boolean isAggressive() {
// return this.getBrightness(1.0f) < 0.5f;
// }
//
// public boolean isPeaceful() {
// return false;
// }
// public boolean isAggressive(Class<? extends EntityNPC> clazz) {
// return false;
// }
//
// public boolean isPeaceful(Class<? extends EntityNPC> clazz) {
// return false;
// }
// public boolean canInfight(Alignment align) {
// return true;
// }
//
// public boolean canMurder(Alignment align) {
// return false;
// }
// public boolean canUseMagic() {
// return false;
// }
public int getBaseHealth(Random rand) {
return rand.range(16, 24);
}
// public int getBaseEnergy(Random rand) {
// return 0;
// }
// public float getHeightDeviation(Random rand) {
// return rand.frange(0.0f, 0.25f);
// }
public float getHeightDeviationMax() {
return 0.25f;
}
public float getHeightDeviationMax() {
return 0.25f;
}
public Alignment getNaturalAlign() {
return rand.pick(Alignment.LAWFUL_EVIL, Alignment.EVIL, Alignment.LAWFUL, Alignment.NEUTRAL);
}
public boolean attackEntityAsMob(Entity entityIn)
{
if(super.attackEntityAsMob(entityIn)) {
if(entityIn instanceof EntityLiving && this.rand.chance(50))
((EntityLiving)entityIn).addEffect(new PotionEffect(Potion.POISON, this.rand.range(14, 35) * 20, 0));
return true;
}
return false;
}
public boolean attackEntityAsMob(Entity entityIn) {
if(super.attackEntityAsMob(entityIn)) {
if(this.isPoisonous() && entityIn instanceof EntityLiving && this.rand.chance(50))
((EntityLiving)entityIn).addEffect(new PotionEffect(Potion.POISON, this.rand.range(14, 35) * 20, 0));
return true;
}
return false;
}
public boolean isPoisonous() {
return true;
}
public boolean getCanSpawnHere() {
return this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8);
}
public boolean canAmbush(EntityLiving entity) {
return (float)this.getHealth() >= ((float)this.getMaxHealth() / 4.0f);
}
public boolean canUseMagic() {
return true;
}
public float getSpeciesBaseSize() {
return 1.6f;
}
public static class GroupData
{
public Potion potionEffectId;
public boolean isChild;
public GroupData(boolean isChild) {
this.isChild = isChild;
}
public boolean canAmbush(EntityLiving entity) {
return (float)this.getHealth() >= ((float)this.getMaxHealth() / 4.0f);
}
public void pickEffect(Random rand)
{
this.potionEffectId = rand.pick(Potion.SPEED, Potion.SPEED, Potion.STRENGTH, Potion.REGENERATION);
}
}
public boolean canUseMagic() {
return true;
}
public float getSpeciesBaseSize() {
return 1.6f;
}
}

View file

@ -4314,11 +4314,11 @@ public abstract class EntityNPC extends EntityLiving
}
public Object onInitialSpawn(Object livingdata) {
// if(this.isPlayer()) {
// this.setCustomNameTag(this.pickRandomName(this.rand, null));
// return livingdata;
// }
livingdata = super.onInitialSpawn(livingdata);
return this.initializeBase(livingdata);
}
protected Object initializeBase(Object livingdata) {
livingdata = super.onInitialSpawn(livingdata);
CharacterInfo info = (livingdata instanceof CharacterTypeData) ? ((CharacterTypeData)livingdata).character :
this.species.pickCharacter(this.worldObj.rand);
AlignmentData align = livingdata instanceof AlignmentData ? ((AlignmentData)livingdata) : null;

View file

@ -0,0 +1,52 @@
package common.entity.npc;
import common.entity.types.EntityLiving;
import common.rng.Random;
import common.world.World;
public class EntityTinyArachnoid extends EntityArachnoid {
public EntityTinyArachnoid(World worldIn) {
super(worldIn);
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.setAttackDamageBase(1);
}
public Object onInitialSpawn(Object livingdata) {
return this.initializeBase(livingdata);
}
public int getBaseHealth(Random rand) {
return rand.range(1, 3);
}
public float getHeightDeviationMax() {
return 0.05f;
}
public Alignment getNaturalAlign() {
return rand.pick(Alignment.LAWFUL_EVIL, Alignment.LAWFUL, Alignment.NEUTRAL);
}
public boolean getCanSpawnHere() {
return true;
}
public boolean canAmbush(EntityLiving entity) {
return true;
}
public boolean canUseMagic() {
return false;
}
public float getSpeciesBaseSize() {
return 0.25f;
}
public boolean isPoisonous() {
return false;
}
}

View file

@ -101,6 +101,7 @@ import common.block.tech.BlockChest;
import common.block.tech.BlockCore;
import common.block.tech.BlockDaylightDetector;
import common.block.tech.BlockDispenser;
import common.block.tech.BlockDisplay;
import common.block.tech.BlockDropper;
import common.block.tech.BlockEnchantmentTable;
import common.block.tech.BlockFurnace;
@ -461,6 +462,7 @@ public abstract class BlockRegistry {
.setTab(CheatTab.DECORATION));
register("sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
register("wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
register("display", (new BlockDisplay()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Anzeige"));
register("banner", (new BlockBannerStanding()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
register("wall_banner", (new BlockBannerHanging()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));

View file

@ -591,6 +591,7 @@ public abstract class Blocks {
public static final BlockStairs floor_tiles_white_stairs = get("floor_tiles_white_stairs");
public static final BlockSlab pentagram_slab = get("pentagram_slab");
public static final BlockStairs pentagram_stairs = get("pentagram_stairs");
public static final BlockDisplay display = get("display");
private static <T extends Block> T get(String id) {
T block = (T)BlockRegistry.byNameExact(id);

View file

@ -216,7 +216,7 @@ public abstract class ItemRegistry {
register("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
for(Weather weather : Weather.values()) {
register("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.TOOLS));
register("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.MAGIC));
}
register("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug"));
@ -279,7 +279,7 @@ public abstract class ItemRegistry {
register("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen"));
register("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS));
register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC));
register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256));
register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256));
@ -311,9 +311,9 @@ public abstract class ItemRegistry {
register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
register("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA));
register("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.FOOD));
register("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete").setTab(CheatTab.TOOLS));
register("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete").setTab(CheatTab.EXPLOSIVES));
register("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS));
register("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC));
register("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.ENCHANTMENTS));
register("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
register("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS);

View file

@ -972,6 +972,7 @@ public abstract class Items {
public static final ItemBlock floor_tiles_white_stairs = get("floor_tiles_white_stairs");
public static final ItemSlab pentagram_slab = get("pentagram_slab");
public static final ItemBlock pentagram_stairs = get("pentagram_stairs");
public static final ItemBlock display = get("display");
private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id);

View file

@ -30,6 +30,7 @@ import common.entity.npc.EntitySlime;
import common.entity.npc.EntitySpaceMarine;
import common.entity.npc.EntitySpirit;
import common.entity.npc.EntityTiefling;
import common.entity.npc.EntityTinyArachnoid;
import common.entity.npc.EntityUndead;
import common.entity.npc.EntityVampire;
import common.entity.npc.EntityWoodElf;
@ -117,6 +118,7 @@ public abstract class SpeciesRegistry {
registerSpecies("Undead", EntityUndead.class, "terra", "Untoter", 0xc1c1c1, 0x494949, ":undead_1", ":undead_2", ":undead_3",
":undead_4");
registerSpecies("Arachnoid", EntityArachnoid.class, "tbd", "Arachnoidea", ModelType.ARACHNOID, 0x342d27, 0xa80e0e);
registerSpecies("TinyArachnoid", EntityTinyArachnoid.class, "tbd", "Kleiner Arachnoidea", ModelType.ARACHNOID, 0x142d27, 0x780e0e);
registerSpecies("Mage", EntityMage.class, "terra", "Magier", 0x340000, 0x51a03e, ":mage_1", ":mage_2", ":mage_3",
":mage_4", ":mage_5", ":mage_6");
registerSpecies("Gargoyle", EntityGargoyle.class, "tbd", "Gargoyle", 0x401010, 0x534437);

View file

@ -11,6 +11,7 @@ import common.tileentity.TileEntityChest;
import common.tileentity.TileEntityComparator;
import common.tileentity.TileEntityDaylightDetector;
import common.tileentity.TileEntityDispenser;
import common.tileentity.TileEntityDisplay;
import common.tileentity.TileEntityDropper;
import common.tileentity.TileEntityEnchantmentTable;
import common.tileentity.TileEntityFurnace;
@ -41,6 +42,7 @@ public abstract class TileRegistry {
addMapping(TileEntityDispenser.class, "Trap");
addMapping(TileEntityDropper.class, "Dropper");
addMapping(TileEntitySign.class, "Sign");
addMapping(TileEntityDisplay.class, "Display");
addMapping(TileEntityPiston.class, "Piston");
addMapping(TileEntityBrewingStand.class, "Cauldron");
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");

View file

@ -97,11 +97,21 @@ public enum CheatTab {
return Items.potion;
}
},
MAGIC("Verzauberungen", false) {
ENCHANTMENTS("Verzauberungen", false) {
protected Item getIconItem() {
return Items.enchanted_book;
}
},
MAGIC("Magie", false) {
protected Item getIconItem() {
return Items.charged_orb;
}
},
EXPLOSIVES("Sprengstoff", false) {
protected Item getIconItem() {
return Items.dynamite;
}
},
MATERIALS("Werkstoffe", false) {
protected Item getIconItem() {
return Items.leather;

View file

@ -2,6 +2,7 @@ package common.item.spawner;
import common.block.tech.BlockRailBase;
import common.entity.item.EntityCart;
import common.entity.item.EntityCart.EnumMinecartType;
import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.item.CheatTab;
@ -22,7 +23,7 @@ public class ItemMinecart extends Item
{
this.setMaxAmount(1);
this.minecartType = type;
this.setTab(CheatTab.VEHICLES);
this.setTab(type == EnumMinecartType.TNT ? CheatTab.EXPLOSIVES : CheatTab.VEHICLES);
// if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK)
}

View file

@ -20,7 +20,7 @@ public class ItemChargedOrb extends ItemFragile
{
public ItemChargedOrb()
{
this.setTab(CheatTab.TOOLS);
this.setTab(CheatTab.MAGIC);
this.setMaxDamage(16);
this.setColor(TextColor.DMAGENTA);
}

View file

@ -25,7 +25,7 @@ public class ItemDynamite extends Item {
public ItemDynamite(int power) {
this.power = power;
this.setMaxAmount(32);
this.setTab(CheatTab.TOOLS);
this.setTab(CheatTab.EXPLOSIVES);
DYNAMITE[power] = this;
}

View file

@ -16,7 +16,7 @@ public class ItemExpBottle extends Item
{
public ItemExpBottle()
{
this.setTab(CheatTab.TOOLS);
this.setTab(CheatTab.MAGIC);
}
public boolean hasEffect(ItemStack stack)

View file

@ -61,6 +61,7 @@ import common.packet.SPacketSpawnObject;
import common.packet.SPacketSpawnPlayer;
import common.packet.SPacketTimeUpdate;
import common.packet.SPacketTrades;
import common.packet.SPacketUpdateDisplay;
import common.packet.SPacketUpdateHealth;
import common.packet.SPacketWorld;
import common.sound.Sound;
@ -115,6 +116,7 @@ public interface IClientPlayer extends NetHandler {
void handleWindowItems(SPacketWindowItems packet);
void handleSignEditorOpen(SPacketSignEditorOpen packet);
void handleUpdateSign(SPacketUpdateSign packet);
void handleUpdateDisplay(SPacketUpdateDisplay packet);
void handleUpdateTileEntity(SPacketUpdateTileEntity packet);
void handleWindowProperty(SPacketWindowProperty packet);
void handleEntityEquipment(SPacketEntityEquipment packet);

View file

@ -97,6 +97,7 @@ import common.packet.SPacketSpawnObject;
import common.packet.SPacketSpawnPlayer;
import common.packet.SPacketTimeUpdate;
import common.packet.SPacketTrades;
import common.packet.SPacketUpdateDisplay;
import common.packet.SPacketUpdateHealth;
import common.packet.SPacketWorld;
@ -167,6 +168,7 @@ public enum PacketRegistry {
this.server(SPacketWindowProperty.class);
this.server(SPacketConfirmTransaction.class);
this.server(SPacketUpdateSign.class);
this.server(SPacketUpdateDisplay.class);
this.server(SPacketUpdateTileEntity.class);
this.server(SPacketSignEditorOpen.class);
this.server(SPacketPlayerListItem.class);

View file

@ -0,0 +1,52 @@
package common.packet;
import java.io.IOException;
import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.util.BlockPos;
public class SPacketUpdateDisplay implements Packet<IClientPlayer> {
private BlockPos position;
private int[] pixels;
public SPacketUpdateDisplay() {
}
public SPacketUpdateDisplay(BlockPos pos, int[] pixels) {
this.position = pos;
this.pixels = pixels;
}
public void readPacketData(PacketBuffer buf) throws IOException {
this.position = buf.readBlockPos();
this.pixels = new int[256];
for(int i = 0; i < 256; ++i) {
this.pixels[i] = 0xff000000 | buf.readUnsignedByte() << 16 | buf.readUnsignedByte() << 8 | buf.readUnsignedByte();
}
}
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeBlockPos(this.position);
for(int i = 0; i < 256; ++i) {
buf.writeByte((this.pixels[i] >> 16) & 255);
buf.writeByte((this.pixels[i] >> 8) & 255);
buf.writeByte(this.pixels[i] & 255);
}
}
public void processPacket(IClientPlayer handler) {
handler.handleUpdateDisplay(this);
}
public BlockPos getPos() {
return this.position;
}
public int[] getPixels() {
return this.pixels;
}
}

View file

@ -6,25 +6,20 @@ import common.network.IClientPlayer;
import common.network.Packet;
import common.network.PacketBuffer;
import common.util.BlockPos;
import common.world.World;
public class SPacketUpdateSign implements Packet<IClientPlayer>
{
private World world;
private BlockPos blockPos;
private String[] lines;
// private String command;
public SPacketUpdateSign()
{
}
public SPacketUpdateSign(World worldIn, BlockPos blockPosIn, String[] linesIn)
public SPacketUpdateSign(BlockPos blockPosIn, String[] linesIn)
{
this.world = worldIn;
this.blockPos = blockPosIn;
this.lines = new String[] {linesIn[0], linesIn[1], linesIn[2], linesIn[3]};
// this.command = commandIn != null && commandIn.isEmpty() ? null : commandIn;
}
/**
@ -39,9 +34,6 @@ public class SPacketUpdateSign implements Packet<IClientPlayer>
{
this.lines[i] = buf.readString(64);
}
// this.command = buf.readStringFromBuffer(1024);
// this.command = this.command.isEmpty() ? null : this.command;
}
/**
@ -55,8 +47,6 @@ public class SPacketUpdateSign implements Packet<IClientPlayer>
{
buf.writeString(this.lines[i]);
}
// buf.writeString(this.command == null ? "" : this.command);
}
/**
@ -76,9 +66,4 @@ public class SPacketUpdateSign implements Packet<IClientPlayer>
{
return this.lines;
}
// public String getCommand()
// {
// return this.command;
// }
}

View file

@ -0,0 +1,40 @@
package common.tileentity;
import java.util.Arrays;
import common.network.Packet;
import common.packet.SPacketUpdateDisplay;
import common.tags.TagObject;
public class TileEntityDisplay extends TileEntity {
public int[] data = new int[256];
public long lastUpdated;
public TileEntityDisplay() {
Arrays.fill(this.data, 0xff000000);
}
public void writeTags(TagObject compound) {
super.writeTags(compound);
compound.setIntArray("Pixels", this.data);
}
public void readTags(TagObject compound) {
super.readTags(compound);
this.data = compound.getIntArray("Pixels");
if(this.data.length != 256)
this.data = new int[256];
}
public Packet getDescriptionPacket() {
return new SPacketUpdateDisplay(this.pos, this.data);
}
public int getColor() {
return 0x00ff00;
}
public void setPixel(int x, int y, int color) {
this.data[x + y * 16] = color | 0xff000000;
}
}

View file

@ -30,7 +30,7 @@ public class TileEntitySign extends TileEntity {
String[] aichatcomponent = new String[4];
System.arraycopy(this.signText, 0, aichatcomponent, 0, 4);
// Sign sign = Server.getServer().getSigns().getEntry(new WorldPos(this).toString());
return new SPacketUpdateSign(this.worldObj, this.pos, aichatcomponent);
return new SPacketUpdateSign(this.pos, aichatcomponent);
}
public void setPlayer(EntityNPC playerIn) {