the ferocious muncher

This commit is contained in:
Boblet 2022-05-06 13:42:02 +02:00
parent f3837beb70
commit 860d0c61a3
15 changed files with 223 additions and 23 deletions

View File

@ -633,7 +633,7 @@ public class ModBlocks {
public static Block machine_difurnace_rtg_off;
public static Block machine_difurnace_rtg_on;
public static final int guiID_test_difurnace = 1;
public static final int guiID_rtg_difurnace = 2001;
public static final int guiID_rtg_difurnace = 125;
public static Block machine_centrifuge;
public static final int guiID_centrifuge = 5;

View File

@ -1,4 +1,4 @@
package com.hbm.entity.item;
package com.hbm.entity.cart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -1,4 +1,4 @@
package com.hbm.entity.item;
package com.hbm.entity.cart;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
@ -39,9 +39,4 @@ public class EntityMinecartCrate extends EntityMinecartContainerBase {
public int getSizeInventory() {
return 9 * 6;
}
@Override
public int getMinecartType() {
return -1;
}
}

View File

@ -0,0 +1,48 @@
package com.hbm.entity.cart;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class EntityMinecartDestroyer extends EntityMinecartContainerBase {
public EntityMinecartDestroyer(World p_i1712_1_) {
super(p_i1712_1_);
}
public EntityMinecartDestroyer(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Override
public boolean interactFirst(EntityPlayer player) {
if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, player)))
return true;
if(!this.worldObj.isRemote) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModItems.guiID_cart_destroyer, worldObj, this.getEntityId(), 0, 0);
}
return true;
}
@Override
public Block func_145817_o() {
return ModBlocks.machine_shredder;
}
@Override
public int getSizeInventory() {
return 18;
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
return false;
}
}

View File

@ -3,7 +3,8 @@ package com.hbm.handler;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
import com.hbm.blocks.machine.NTMAnvil;
import com.hbm.entity.item.EntityMinecartCrate;
import com.hbm.entity.cart.EntityMinecartCrate;
import com.hbm.entity.cart.EntityMinecartDestroyer;
import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.container.*;
import com.hbm.inventory.gui.*;
@ -859,12 +860,10 @@ public class GUIHandler implements IGuiHandler {
// NON-TE CONTAINERS
switch(ID) {
case ModItems.guiID_item_box:
return new ContainerLeadBox(player, player.inventory, new InventoryLeadBox(player.getHeldItem()));
case ModItems.guiID_item_book:
return new ContainerBook(player.inventory);
case ModItems.guiID_cart_crate:
return new ContainerCrateSteel(player.inventory, (EntityMinecartCrate)player.worldObj.getEntityByID(x));
case ModItems.guiID_item_box: return new ContainerLeadBox(player, player.inventory, new InventoryLeadBox(player.getHeldItem()));
case ModItems.guiID_item_book: return new ContainerBook(player.inventory);
case ModItems.guiID_cart_crate: return new ContainerCrateSteel(player.inventory, (EntityMinecartCrate)player.worldObj.getEntityByID(x));
case ModItems.guiID_cart_destroyer: return new ContainerCartDestroyer(player.inventory, (EntityMinecartDestroyer)player.worldObj.getEntityByID(x));
}
return null;
@ -1728,8 +1727,9 @@ public class GUIHandler implements IGuiHandler {
return new GUIScreenHolotape();
case ModItems.guiID_item_fluid:
return new GUIScreenFluid(player);
case ModItems.guiID_cart_crate:
return new GUICrateSteel(player.inventory, (EntityMinecartCrate) player.worldObj.getEntityByID(x));
case ModItems.guiID_cart_crate: return new GUICrateSteel(player.inventory, (EntityMinecartCrate) player.worldObj.getEntityByID(x));
case ModItems.guiID_cart_destroyer: return new GUICartDestroyer(player.inventory, (EntityMinecartDestroyer) player.worldObj.getEntityByID(x));
}
return null;
}

View File

@ -0,0 +1,22 @@
package com.hbm.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class SlotPattern extends Slot {
public SlotPattern(IInventory inv, int index, int x, int y) {
super(inv, index, x, y);
}
@Override
public boolean canTakeStack(EntityPlayer player) {
return false;
}
@Override
public int getSlotStackLimit() {
return 1;
}
}

View File

@ -0,0 +1,79 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotPattern;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerCartDestroyer extends Container {
private IInventory diFurnace;
public ContainerCartDestroyer(InventoryPlayer invPlayer, IInventory tedf) {
diFurnace = tedf;
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotPattern(tedf, j + i * 3, 10 + j * 18, 17 + i * 18));
this.addSlotToContainer(new SlotPattern(tedf, j + i * 3 + 9, 114 + j * 18, 17 + i * 18));
}
}
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
return null;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return diFurnace.isUseableByPlayer(player);
}
@Override
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
//L/R: 0
//M3: 3
//SHIFT: 1
//DRAG: 5
//System.out.println("Mode " + mode);
//System.out.println("Slot " + index);
if(index < 0 || index >= diFurnace.getSizeInventory()) {
return super.slotClick(index, button, mode, player);
}
Slot slot = this.getSlot(index);
ItemStack ret = null;
ItemStack held = player.inventory.getItemStack();
if(slot.getHasStack())
ret = slot.getStack().copy();
slot.putStack(held != null ? held.copy() : null);
if(slot.getHasStack()) {
slot.getStack().stackSize = 1;
}
slot.onSlotChanged();
return ret;
}
}

View File

@ -0,0 +1,50 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerCartDestroyer;
import com.hbm.lib.RefStrings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
public class GUICartDestroyer extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/cart/gui_destroyer.png");
private IInventory cart;
public GUICartDestroyer(InventoryPlayer invPlayer, IInventory inv) {
super(new ContainerCartDestroyer(invPlayer, inv));
cart = inv;
this.xSize = 176;
this.ySize = 166;
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.cart.hasCustomInventoryName() ? this.cart.getInventoryName() : I18n.format(this.cart.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int time = (int) (System.currentTimeMillis() % 1000);
int index = time / 128;
if(index == 1 || index == 7) drawTexturedModalRect(guiLeft + 66, guiTop + 35, 0, 166, 44, 16);
if(index == 2 || index == 6) drawTexturedModalRect(guiLeft + 66, guiTop + 35, 0, 182, 44, 16);
if(index == 3 || index == 5) drawTexturedModalRect(guiLeft + 66, guiTop + 35, 0, 198, 44, 16);
if(index == 4) drawTexturedModalRect(guiLeft + 66, guiTop + 35, 0, 214, 44, 16);
}
}

View File

@ -2555,6 +2555,7 @@ public class ModItems {
public static final int guiID_item_holo_image = 10108;
public static final int guiID_cart_crate = 2000;
public static final int guiID_cart_destroyer = 2001;
public static Item mysteryshovel;
public static Item memory;

View File

@ -1,6 +1,6 @@
package com.hbm.items.tool;
import com.hbm.entity.item.EntityMinecartCrate;
import com.hbm.entity.cart.*;
import com.hbm.items.ItemEnumMulti;
import net.minecraft.block.Block;
@ -21,7 +21,8 @@ import net.minecraft.world.World;
public class ItemModMinecart extends ItemEnumMulti {
public static enum EnumMinecart {
CRATE
CRATE,
DESTROYER
}
public ItemModMinecart() {
@ -95,6 +96,7 @@ public class ItemModMinecart extends ItemEnumMulti {
public static EntityMinecart createMinecart(World world, double x, double y, double z, EnumMinecart type) {
switch(type) {
case CRATE: return new EntityMinecartCrate(world, x, y, z);
case DESTROYER: return new EntityMinecartDestroyer(world, x, y, z);
default: return new EntityMinecartEmpty(world, x, y, z);
}
}

View File

@ -41,6 +41,7 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockBobble.TileEntityBobble;
import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
import com.hbm.entity.cart.*;
import com.hbm.entity.effect.*;
import com.hbm.entity.grenade.*;
import com.hbm.entity.item.*;
@ -624,6 +625,7 @@ public class ClientProxy extends ServerProxy {
//minecarts
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartTest.class, new RenderMinecartTest());
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartCrate.class, new RenderMinecart());
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartDestroyer.class, new RenderMinecart());
//items
RenderingRegistry.registerEntityRenderingHandler(EntityMovingItem.class, new RenderMovingItem());
RenderingRegistry.registerEntityRenderingHandler(EntityTNTPrimedBase.class, new RenderTNTPrimedBase());

View File

@ -883,7 +883,8 @@ public class CraftingManager {
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.HADRON.ordinal()), new Object[] { Items.book, ModItems.fuse });
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()), new Object[] { Items.book, Items.iron_ingot });
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "IGI", "ICI", "PDP", 'I', STEEL.ingot(), 'G', Items.glowstone_dust, 'C', ModBlocks.red_wire_coated, 'P', IRON.plate(), 'D', ModItems.coil_copper });
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "G", "S", "C", 'G', Items.glowstone_dust, 'S', STEEL.ingot(), 'C', ModItems.coil_copper });
addRecipeAuto(new ItemStack(ModBlocks.charger, 16), new Object[] { "G", "S", "C", 'G', Blocks.glowstone, 'S', STEEL.block(), 'C', ModItems.coil_copper_torus });
addRecipeAuto(new ItemStack(ModBlocks.press_preheater), new Object[] { "CCC", "SLS", "TST", 'C', ModItems.board_copper, 'S', Blocks.stone, 'L', Fluids.LAVA.getDict(1000), 'T', W.ingot() });
addShapelessAuto(new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_RESTORED.ordinal()), new Object[] { new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_DIGAMMA.ordinal()), KEY_TOOL_SCREWDRIVER, ModItems.ducttape, ModItems.armor_polish });

View File

@ -14,7 +14,6 @@ import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.AchievementPage;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.ForgeChunkManager;
@ -41,9 +40,9 @@ import org.apache.logging.log4j.Logger;
import com.google.common.collect.ImmutableList;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockMotherOfAllOres;
import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType;
import com.hbm.config.*;
import com.hbm.creativetabs.*;
import com.hbm.entity.cart.*;
import com.hbm.entity.effect.*;
import com.hbm.entity.grenade.*;
import com.hbm.entity.item.*;
@ -491,7 +490,8 @@ public class MainRegistry {
EntityRegistry.registerModEntity(EntityTNTPrimedBase.class, "entity_ntm_tnt_primed", 166, this, 1000, 1, true);
EntityRegistry.registerModEntity(EntityGrenadeBouncyGeneric.class, "entity_grenade_bouncy_generic", 168, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityGrenadeImpactGeneric.class, "entity_grenade_impact_generic", 169, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 170, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 170, this, 250, 1, false);
EntityRegistry.registerModEntity(EntityMinecartDestroyer.class, "entity_ntm_cart_crate", 171, this, 250, 1, false);
EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00);
EntityRegistry.registerGlobalEntityID(EntityTaintedCreeper.class, "entity_mob_tainted_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x813b9b, 0xd71fdd);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B