Skip to content

Commit

Permalink
aux particle packet, concrete variation recipes, locked hopper fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Apr 12, 2019
1 parent 8f8b724 commit 6764c67
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 22 deletions.
3 changes: 3 additions & 0 deletions assets/hbm/lang/de_DE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ tile.reinforced_stone.name=Verdichteter Stein
tile.concrete_smooth.name=Beton
tile.concrete.name=Betonfliese
tile.brick_concrete.name=Betonziegel
tile.brick_concrete_mossy.name=Bemooste Betonziegel
tile.brick_concrete_cracked.name=Rissige Betonziegel
tile.brick_concrete_broken.name=Gebrochene Betonziegel
tile.brick_obsidian.name=Obsidianziegel
tile.brick_light.name=Helle Ziegel
tile.asphalt.name=Asphalt
Expand Down
3 changes: 3 additions & 0 deletions assets/hbm/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ tile.reinforced_stone.name=Dense Stone
tile.concrete_smooth.name=Concrete
tile.concrete.name=Concrete Tile
tile.brick_concrete.name=Concrete Bricks
tile.brick_concrete_mossy.name=Mossy Concrete Bricks
tile.brick_concrete_cracked.name=Cracked Concrete Bricks
tile.brick_concrete_broken.name=Broken Concrete Bricks
tile.brick_obsidian.name=Obsidian Bricks
tile.brick_light.name=Light Bricks
tile.asphalt.name=Asphalt
Expand Down
11 changes: 7 additions & 4 deletions com/hbm/entity/projectile/EntityWaterSplash.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.hbm.entity.projectile;

import com.hbm.entity.particle.EntityOilSpillFX;
import com.hbm.packet.AuxParticlePacket;
import com.hbm.packet.PacketDispatcher;

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.MovingObjectPosition;
Expand Down Expand Up @@ -30,13 +34,12 @@ public EntityWaterSplash(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_,
@Override
public void onUpdate() {
super.onUpdate();

for(int i = 0; i < 10; i++)
worldObj.spawnParticle("cloud", posX + rand.nextGaussian(), posY + rand.nextGaussian(), posZ + rand.nextGaussian(), 0.0D, 0.0D, 0.0D);

if(!worldObj.isRemote) {

if(this.ticksExisted > 100) {
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(posX, posY, posZ, 0), new TargetPoint(this.dimension, posX, posY, posZ, 75));

if(this.ticksExisted > 80) {
this.setDead();
}
}
Expand Down
2 changes: 1 addition & 1 deletion com/hbm/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -4514,7 +4514,7 @@ private static void registerItem() {
GameRegistry.registerItem(wand, wand.getUnlocalizedName());
GameRegistry.registerItem(wand_s, wand_s.getUnlocalizedName());
GameRegistry.registerItem(wand_d, wand_d.getUnlocalizedName());
GameRegistry.registerItem(analyzer, analyzer.getUnlocalizedName());
//GameRegistry.registerItem(analyzer, analyzer.getUnlocalizedName());
//GameRegistry.registerItem(remote, remote.getUnlocalizedName());
GameRegistry.registerItem(euphemium_stopper, euphemium_stopper.getUnlocalizedName());
GameRegistry.registerItem(polaroid, polaroid.getUnlocalizedName());
Expand Down
4 changes: 2 additions & 2 deletions com/hbm/items/tool/ItemLeadBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public int getMaxItemUseDuration(ItemStack stack) {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {

if(world.isRemote)
player.openGui(MainRegistry.instance, ModItems.guiID_item_box, world, 0, 0, 0);
//if(world.isRemote)
// player.openGui(MainRegistry.instance, ModItems.guiID_item_box, world, 0, 0, 0);

return stack;
}
Expand Down
6 changes: 3 additions & 3 deletions com/hbm/lib/HbmWorldGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private void generateSurface(World world, Random rand, int i, int j) {
}
}

if (biome == BiomeGenBase.plains && rand.nextInt(20) == 0) {
if (biome == BiomeGenBase.plains && rand.nextInt(MainRegistry.geyserWater) == 0) {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z);
Expand All @@ -427,7 +427,7 @@ private void generateSurface(World world, Random rand, int i, int j) {
new Geyser().generate(world, rand, x, y, z);
}

if (biome == BiomeGenBase.desert && rand.nextInt(20) == 0) {
if (biome == BiomeGenBase.desert && rand.nextInt(MainRegistry.geyserChlorine) == 0) {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z);
Expand All @@ -436,7 +436,7 @@ private void generateSurface(World world, Random rand, int i, int j) {
new GeyserLarge().generate(world, rand, x, y, z);
}

if (rand.nextInt(20) == 0) {
if (rand.nextInt(MainRegistry.geyserVapor) == 0) {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z);
Expand Down
2 changes: 1 addition & 1 deletion com/hbm/lib/RefStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (3062)";
public static final String VERSION = "1.0.27 BETA (3106)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version
Expand Down
5 changes: 4 additions & 1 deletion com/hbm/main/CraftingManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@ public static void AddCraftingRec()
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.concrete), 4), new Object[] { "CC", "CC", 'C', ModBlocks.concrete_smooth });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete), 4), new Object[] { " C ", "CBC", " C ", 'C', ModBlocks.concrete_smooth, 'B', Items.clay_ball });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete), 4), new Object[] { " C ", "CBC", " C ", 'C', ModBlocks.concrete, 'B', Items.clay_ball });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete_mossy), 8), new Object[] { "CCC", "CVC", "CCC", 'C', ModBlocks.brick_concrete, 'V', Blocks.vine });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete_cracked), 6), new Object[] { " C " , "C C", " C ", 'C', ModBlocks.brick_concrete });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_concrete_broken), 6), new Object[] { " C " , "C C", " C ", 'C', ModBlocks.brick_concrete_cracked });
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.brick_obsidian), 4), new Object[] { "FBF", "BFB", "FBF", 'F', Blocks.iron_bars, 'B', Blocks.obsidian });
//GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.cmb_brick), 4), new Object[] { "PPP", "PIP", "PPP", 'P', ModItems.plate_combine_steel, 'I', ModItems.ingot_combine_steel });
//GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.cmb_brick_reinforced), 8), new Object[] { "TBT", "BCB", "TBT", 'T', ModBlocks.block_magnetized_tungsten, 'B', ModBlocks.brick_concrete, 'C', ModBlocks.cmb_brick });
Expand Down Expand Up @@ -1411,7 +1414,7 @@ public static void reg2() {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.crystal_pulsar, 32), new Object[] { "STS", "THT", "STS", 'S', ModItems.cell_uf6, 'T', "dustAluminum", 'H', ModItems.crystal_charred }));

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fluid_duct, 8), new Object[] { "SAS", " ", "SAS", 'S', "plateSteel", 'A', "plateAluminum" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_assembler, 1), new Object[] { "WWW", "MCM", "ISI", 'W', ModItems.coil_copper, 'M', ModItems.motor, 'C', ModItems.circuit_aluminium, 'I', "blockIron", 'S', "blockSteel" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_assembler, 1), new Object[] { "WWW", "MCM", "ISI", 'W', "paneGlass", 'M', ModItems.motor, 'C', ModItems.circuit_aluminium, 'I', "blockCopper", 'S', "blockSteel" }));
//GameRegistry.addRecipe(new ItemStack(ModBlocks.machine_chemplant, 1), new Object[] { "HTT", "HPP", "DCD", 'H', ModItems.hull_big_steel, 'T', ModItems.tank_steel, 'P', Blocks.piston, 'D', ModBlocks.fluid_duct, 'C', ModItems.circuit_red_copper });
//GameRegistry.addRecipe(new ItemStack(ModBlocks.machine_fluidtank, 1), new Object[] { "HHH", "HHH", "D D", 'H', ModItems.hull_big_steel, 'D', ModBlocks.fluid_duct });
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_pumpjack, 1), new Object[] { "BBB", "PSM", "PST", 'B', "blockSteel", 'P', ModItems.pipes_steel, 'S', ModBlocks.steel_scaffold, 'M', ModItems.motor, 'T', ModItems.tank_steel }));
Expand Down
17 changes: 17 additions & 0 deletions com/hbm/main/MainRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,15 @@ public class MainRegistry
public static int dudStructure = 500;
public static int spaceshipStructure = 1000;
public static int barrelStructure = 5000;
public static int geyserWater = 3000;
public static int geyserChlorine = 3000;
public static int geyserVapor = 500;

public static int broadcaster = 5000;
public static int minefreq = 64;
public static int radfreq = 5000;
public static int vaultfreq = 2500;

public static int meteorStrikeChance = 20 * 60 * 180;
public static int meteorShowerChance = 20 * 60 * 5;
public static int meteorShowerDuration = 6000;
Expand Down Expand Up @@ -1615,6 +1620,15 @@ public void preInit(FMLPreInitializationEvent event)
Property propVault = config.get(CATEGORY_DUNGEON, "4.16_vaultSpawn", 2500);
propVault.comment = "Spawn locked safe on every nTH chunk";
vaultfreq = propVault.getInt();
Property pGW = config.get(CATEGORY_DUNGEON, "4.17_geyserWaterSpawn", 3000);
pGW.comment = "Spawn water geyser on every nTH chunk";
geyserWater = pGW.getInt();
Property pGC = config.get(CATEGORY_DUNGEON, "4.18_geyserChlorineSpawn", 3000);
pGC.comment = "Spawn poison geyser on every nTH chunk";
geyserChlorine = pGC.getInt();
Property pGV = config.get(CATEGORY_DUNGEON, "4.19_geyserVaporSpawn", 500);
pGV.comment = "Spawn vapor geyser on every nTH chunk";
geyserVapor = pGV.getInt();

final String CATEGORY_METEOR = "05_meteors";
Property propMeteorStrikeChance = config.get(CATEGORY_METEOR, "5.00_meteorStrikeChance", 20 * 60 * 180);
Expand Down Expand Up @@ -1717,6 +1731,9 @@ public void preInit(FMLPreInitializationEvent event)
dudStructure = setDef(dudStructure, 1000);
spaceshipStructure = setDef(spaceshipStructure, 1000);
barrelStructure = setDef(barrelStructure, 1000);
geyserWater = setDef(geyserWater, 1000);
geyserChlorine = setDef(geyserChlorine, 1000);
geyserVapor = setDef(geyserVapor, 1000);
broadcaster = setDef(broadcaster, 1000);
minefreq = setDef(minefreq, 1000);
radfreq = setDef(radfreq, 1000);
Expand Down
83 changes: 83 additions & 0 deletions com/hbm/packet/AuxParticlePacket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.hbm.packet;

import com.hbm.tileentity.machine.TileEntityMachineAssembler;
import com.hbm.tileentity.machine.TileEntityMachinePumpjack;

import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityCloudFX;
import net.minecraft.client.particle.EntitySmokeFX;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class AuxParticlePacket implements IMessage {

double x;
double y;
double z;
int type;

public AuxParticlePacket()
{

}

public AuxParticlePacket(double x, double y, double z, int type)
{
this.x = x;
this.y = y;
this.z = z;
this.type = type;
}

@Override
public void fromBytes(ByteBuf buf) {
x = buf.readDouble();
y = buf.readDouble();
z = buf.readDouble();
type = buf.readInt();
}

@Override
public void toBytes(ByteBuf buf) {
buf.writeDouble(x);
buf.writeDouble(y);
buf.writeDouble(z);
buf.writeInt(type);
}

public static class Handler implements IMessageHandler<AuxParticlePacket, IMessage> {

@Override
public IMessage onMessage(AuxParticlePacket m, MessageContext ctx) {

try {

World world = Minecraft.getMinecraft().theWorld;

switch(m.type) {
case 0:

for(int i = 0; i < 10; i++) {
EntityCloudFX smoke = new EntityCloudFX(world, m.x + world.rand.nextGaussian(), m.y + world.rand.nextGaussian(), m.z + world.rand.nextGaussian(), 0.0, 0.0, 0.0);
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
}
break;

case 1:

EntityCloudFX smoke = new EntityCloudFX(world, m.x, m.y, m.z, 0.0, 0.1, 0.0);
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
break;
}

} catch(Exception x) { }

return null;
}
}
}
2 changes: 2 additions & 0 deletions com/hbm/packet/PacketDispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public static final void registerPackets()
wrapper.registerMessage(TEControlPacket.Handler.class, TEControlPacket.class, i++, Side.CLIENT);
//Sends button information for ItemGunBase
wrapper.registerMessage(GunButtonPacket.Handler.class, GunButtonPacket.class, i++, Side.SERVER);
//Packet to send block break particles
wrapper.registerMessage(AuxParticlePacket.Handler.class, AuxParticlePacket.class, i++, Side.CLIENT);
}

}
4 changes: 2 additions & 2 deletions com/hbm/tileentity/machine/TileEntityCrateIron.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {

@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
return this.isItemValidForSlot(i, itemStack) && !this.isLocked();
}

@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return true;
return !this.isLocked();
}

}
4 changes: 2 additions & 2 deletions com/hbm/tileentity/machine/TileEntityCrateSteel.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {

@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
return this.isItemValidForSlot(i, itemStack) && !this.isLocked();
}

@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return true;
return !this.isLocked();
}
}
14 changes: 10 additions & 4 deletions com/hbm/tileentity/machine/TileEntityMachineChemplant.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import com.hbm.items.tool.ItemChemistryTemplate;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxParticlePacket;
import com.hbm.packet.LoopedSoundPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEAssemblerPacket;
import com.hbm.packet.TEChemplantPacket;

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -432,16 +434,20 @@ public void updateEntity() {

if(isProgressing) {
if(meta == 2) {
worldObj.spawnEntityInWorld(new EntityGasFlameFX(worldObj, xCoord + 0.375, yCoord + 3, zCoord - 0.625, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(xCoord + 0.375, yCoord + 3, zCoord - 0.625, 1),
new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.375, yCoord + 3, zCoord - 0.625, 50));
}
if(meta == 3) {
worldObj.spawnEntityInWorld(new EntityGasFlameFX(worldObj, xCoord + 0.625, yCoord + 3, zCoord + 1.625, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(xCoord + 0.625, yCoord + 3, zCoord + 1.625, 1),
new TargetPoint(worldObj.provider.dimensionId, xCoord + 0.625, yCoord + 3, zCoord + 1.625, 50));
}
if(meta == 4) {
worldObj.spawnEntityInWorld(new EntityGasFlameFX(worldObj, xCoord - 0.625, yCoord + 3, zCoord + 0.625, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(xCoord - 0.625, yCoord + 3, zCoord + 0.625, 1),
new TargetPoint(worldObj.provider.dimensionId, xCoord - 0.625, yCoord + 3, zCoord + 0.625, 50));
}
if(meta == 5) {
worldObj.spawnEntityInWorld(new EntityGasFlameFX(worldObj, xCoord + 1.625, yCoord + 3, zCoord + 0.375, 0.0, 0.0, 0.0));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(xCoord + 1.625, yCoord + 3, zCoord + 0.375, 1),
new TargetPoint(worldObj.provider.dimensionId, xCoord + 1.625, yCoord + 3, zCoord + 0.375, 50));
}
}

Expand Down
4 changes: 2 additions & 2 deletions com/hbm/tileentity/machine/TileEntitySafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {

@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
return this.isItemValidForSlot(i, itemStack) && !this.isLocked();
}

@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return true;
return !this.isLocked();
}
}

0 comments on commit 6764c67

Please sign in to comment.