mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
buoyant items, press fix
This commit is contained in:
parent
305b7232f2
commit
8c5544c9f2
@ -212,6 +212,9 @@ public class EntityMappings {
|
||||
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
|
||||
addEntity(EntityMist.class, "entity_mist", 1000);
|
||||
|
||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||
|
||||
addEntity(SeatDummyEntity.class, "entity_ntm_seat_dummy", 250, false);
|
||||
addEntity(BoundingBoxDummyEntity.class, "entity_ntm_bounding_dummy", 250, false);
|
||||
addEntity(TrainCargoTram.class, "entity_ntm_cargo_tram", 250, false);
|
||||
|
||||
27
src/main/java/com/hbm/entity/item/EntityItemBuoyant.java
Normal file
27
src/main/java/com/hbm/entity/item/EntityItemBuoyant.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityItemBuoyant extends EntityItem {
|
||||
|
||||
public EntityItemBuoyant(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityItemBuoyant(World world, double x, double y, double z, ItemStack stack) {
|
||||
super(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if(worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 0.0625), (int) Math.floor(posZ)).getMaterial() == Material.water) {
|
||||
this.motionY += 0.045D;
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
}
|
||||
@ -7262,6 +7262,7 @@ public class ModItems {
|
||||
|
||||
//Grenades
|
||||
GameRegistry.registerItem(stick_dynamite, stick_dynamite.getUnlocalizedName()); //heave-ho!
|
||||
GameRegistry.registerItem(stick_dynamite_fishing, stick_dynamite_fishing.getUnlocalizedName());
|
||||
GameRegistry.registerItem(stick_tnt, stick_tnt.getUnlocalizedName());
|
||||
GameRegistry.registerItem(stick_semtex, stick_semtex.getUnlocalizedName());
|
||||
GameRegistry.registerItem(stick_c4, stick_c4.getUnlocalizedName());
|
||||
|
||||
@ -2,10 +2,11 @@ package com.hbm.items.weapon;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.item.EntityItemBuoyant;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -32,8 +33,8 @@ public class ItemGrenadeFishing extends ItemGenericGrenade {
|
||||
if(world.getBlock(rX, rY, rZ).getMaterial() == Material.water) {
|
||||
ItemStack loot = this.getRandomLoot(world.rand);
|
||||
if(loot != null) {
|
||||
EntityItem item = new EntityItem(world, rX + 0.5, rY + 0.5, rZ + 0.5, loot.copy());
|
||||
item.motionY = 3;
|
||||
EntityItemBuoyant item = new EntityItemBuoyant(world, rX + 0.5, rY + 0.5, rZ + 0.5, loot.copy());
|
||||
item.motionY = 1;
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ import com.hbm.inventory.recipes.anvil.AnvilRecipes;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemFertilizer;
|
||||
import com.hbm.items.weapon.ItemGenericGrenade;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo4Gauge;
|
||||
import com.hbm.lib.HbmWorld;
|
||||
import com.hbm.lib.Library;
|
||||
@ -613,6 +614,18 @@ public class MainRegistry {
|
||||
return new EntityGrenadeDynamite(world, position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.grenade_kyiv, new BehaviorProjectileDispense() {
|
||||
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.grenade_kyiv);
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite_fishing, new BehaviorProjectileDispense() {
|
||||
|
||||
protected IProjectile getProjectileEntity(World world, IPosition position) {
|
||||
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
|
||||
}
|
||||
});
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.powder_fertilizer, new BehaviorDefaultDispenseItem() {
|
||||
|
||||
private boolean dispenseSound = true;
|
||||
|
||||
@ -171,8 +171,8 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
if(stack.getItem() instanceof ItemStamp && i == 1)
|
||||
return true;
|
||||
if(stack.getItem() instanceof ItemStamp)
|
||||
return i == 1;
|
||||
|
||||
return i == 2;
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
|
||||
if(stack.getItem() instanceof ItemStamp && i == 1)
|
||||
return true;
|
||||
if(stack.getItem() instanceof ItemStamp)
|
||||
return i == 1;
|
||||
|
||||
if(TileEntityFurnace.getItemBurnTime(stack) > 0 && i == 0)
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user