Adds a new ore, and fixes to poss ball

This commit is contained in:
zontreck 2023-12-20 22:24:26 -07:00
parent 46142e36aa
commit 26e3ef9ce1
74 changed files with 462 additions and 73 deletions

View file

@ -76,13 +76,34 @@ public class ModBlocks {
public static final RegistryObject<Item> STABLE_SINGULARITY_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("stable_singularity", ()->new BlockItem(STABLE_SINGULARITY.get(), new Item.Properties())));
public static final RegistryObject<Block> ILUSIUM_ORE_BLOCK = BLOCKS.register("ilusium_ore_block", () -> new Block(BlockBehaviour.Properties.copy(ModBlocks.ETERNIUM_ORE_BLOCK.get()).noOcclusion()));
public static final RegistryObject<Item> ILUSIUM_ORE_BLOCK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_ore_block", () -> new BlockItem(ILUSIUM_ORE_BLOCK.get(), new Item.Properties())));
public static final RegistryObject<Block> DEEPSLATE_ILUSIUM_ORE_BLOCK = BLOCKS.register("deepslate_ilusium_ore_block", () -> new Block(BlockBehaviour.Properties.copy(ILUSIUM_ORE_BLOCK.get()).noOcclusion()));
public static final RegistryObject<Item> DEEPSLATE_ILUSIUM_ORE_BLOCK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("deepslate_ilusium_ore_block", () -> new BlockItem(DEEPSLATE_ILUSIUM_ORE_BLOCK.get(), new Item.Properties())));
public static final RegistryObject<Block> ILUSIUM_BLOCK = BLOCKS.register("ilusium_block", () -> new Block(BlockBehaviour.Properties.copy(ModBlocks.ETERNIUM_BLOCK.get()).noOcclusion().strength(5, 20).requiresCorrectToolForDrops()));
public static final RegistryObject<Item> ILUSIUM_BLOCK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_block", () -> new BlockItem(ILUSIUM_BLOCK.get(), new Item.Properties())));
public static final RegistryObject<Block> LIMINAL_TILES = BLOCKS.register("liminal_tiles", ()-> new Block(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));
public static final RegistryObject<Item> LIMINAL_TILES_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("liminal_tiles", ()->new BlockItem(LIMINAL_TILES.get(), new Item.Properties())));
public static final RegistryObject<Block> BLACK = BLOCKS.register("black", ()->new Block(BlockBehaviour.Properties.copy(Blocks.BEDROCK)));
public static final RegistryObject<Item> BLOCK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("black", ()->new FoiledBlockItem(BLACK.get(), new Item.Properties().stacksTo(128))));
public static final RegistryObject<Item> BLACK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("black", ()->new FoiledBlockItem(BLACK.get(), new Item.Properties().stacksTo(128))));
public static final RegistryObject<Block> LIMINAL_TILE_STAIRS = BLOCKS.register("liminal_tile_stairs", ()->new StairBlock(LIMINAL_TILES.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.BEDROCK).destroyTime(1000).strength(1000)));

View file

@ -55,6 +55,11 @@ public class ModItems {
public static final RegistryObject<Item> POSS_BALL = CreativeModeTabs.addToOTEModTab(ITEMS.register("poss_ball", () -> new PossBallItem(new Item.Properties())));
public static final RegistryObject<Item> ILUSIUM_ORE = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_ore", () -> new Item(new Item.Properties().fireResistant())));
public static final RegistryObject<Item> ILUSIUM_ROD = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_rod", () -> new Item(new Item.Properties().fireResistant())));
public static final RegistryObject<Item> ILUSIUM_DUST = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_dust", () -> new Item(new Item.Properties().fireResistant())));
public static final RegistryObject<Item> ILUSIUM_INGOT = CreativeModeTabs.addToOTEModTab(ITEMS.register("ilusium_ingot", () -> new Item(new Item.Properties().fireResistant())));
//public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties())));

View file

@ -24,10 +24,12 @@ import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import java.util.Optional;
import java.util.UUID;
public class ThrownPossBall extends ThrowableItemProjectile
{
boolean captured = false;
LivingEntity shooter;
public ThrownPossBall(EntityType<? extends ThrownPossBall> entity, Level level)
{
super(entity, level);
@ -35,6 +37,8 @@ public class ThrownPossBall extends ThrowableItemProjectile
public ThrownPossBall(Level level, LivingEntity shooter)
{
super(EntityType.SNOWBALL, shooter, level);
this.shooter = shooter;
}
public ThrownPossBall(Level pLevel, double pX, double pY, double pZ)
@ -91,7 +95,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
cont.commitLore();
le.kill();
le.remove(RemovalReason.DISCARDED);
}
}
}
@ -114,7 +118,11 @@ public class ThrownPossBall extends ThrowableItemProjectile
if(captured)
{
// Spawn poss ball item with the entity NBT
ItemEntity entity = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
ItemEntity entity;
if(shooter != null)
entity = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
else
entity = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
level().addFreshEntity(entity);
} else {
// Spawn the real entity
@ -122,6 +130,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
if(entity.isPresent())
{
Entity xEntity = entity.get();
xEntity.setUUID(UUID.randomUUID());
xEntity.setPos(position());
level().addFreshEntity(xEntity);
}
@ -133,9 +142,16 @@ public class ThrownPossBall extends ThrowableItemProjectile
if(item.getDamageValue() == 0)
{
item.setTag(new CompoundTag());
}else {
tag.remove("entity");
}
ItemEntity x = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
ItemEntity x;
if(shooter!=null)
x = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
else
x = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
level().addFreshEntity(x);
}
} else {
@ -144,7 +160,20 @@ public class ThrownPossBall extends ThrowableItemProjectile
int damage = item.getDamageValue();
damage++;
item.setDamageValue(damage);
ItemEntity entity = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
// Ensure no entity tag!
tag.remove("entity");
if(item.getDamageValue() >= item.getMaxDamage())
return;
ItemEntity entity;
if(shooter!= null)
entity = new ItemEntity(level(),shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
else
entity = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
level().addFreshEntity(entity);
}