update: 1.7.1 + new dependencies
@@ -32,6 +32,7 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.BedrockifierGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.procedures.BedrockifierLogicProcedure;
|
||||
import net.mcreator.nimsrandombullshit.block.entity.BedrockifierBlockEntity;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
@@ -68,6 +69,14 @@ public class BedrockifierBlock extends Block implements EntityBlock {
|
||||
return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState blockstate, Level world, BlockPos pos, Block neighborBlock, BlockPos fromPos, boolean moving) {
|
||||
super.neighborChanged(blockstate, world, pos, neighborBlock, fromPos, moving);
|
||||
if (world.getBestNeighborSignal(pos) > 0) {
|
||||
BedrockifierLogicProcedure.execute(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState blockstate, Level world, BlockPos pos, Player entity, InteractionHand hand, BlockHitResult hit) {
|
||||
super.use(blockstate, world, pos, entity, hand, hit);
|
||||
|
||||
@@ -25,13 +25,16 @@ import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.Containers;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.OreMinerGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.procedures.OreMinerTickUpdateProcedure;
|
||||
import net.mcreator.nimsrandombullshit.block.entity.OreMinerBlockEntity;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
@@ -68,6 +71,22 @@ public class OreMinerBlock extends Block implements EntityBlock {
|
||||
return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlace(BlockState blockstate, Level world, BlockPos pos, BlockState oldState, boolean moving) {
|
||||
super.onPlace(blockstate, world, pos, oldState, moving);
|
||||
world.scheduleTick(pos, this, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState blockstate, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
super.tick(blockstate, world, pos, random);
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
OreMinerTickUpdateProcedure.execute(world, x, y, z);
|
||||
world.scheduleTick(pos, this, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState blockstate, Level world, BlockPos pos, Player entity, InteractionHand hand, BlockHitResult hit) {
|
||||
super.use(blockstate, world, pos, entity, hand, hit);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.block.entity;
|
||||
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.block.entity;
|
||||
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.client.gui;
|
||||
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -6,12 +7,9 @@ import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.BedrockifierGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.network.BedrockifierGUIButtonMessage;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -22,7 +20,6 @@ public class BedrockifierGUIScreen extends AbstractContainerScreen<BedrockifierG
|
||||
private final Level world;
|
||||
private final int x, y, z;
|
||||
private final Player entity;
|
||||
Button button_empty;
|
||||
|
||||
public BedrockifierGUIScreen(BedrockifierGUIMenu container, Inventory inventory, Component text) {
|
||||
super(container, inventory, text);
|
||||
@@ -53,6 +50,8 @@ public class BedrockifierGUIScreen extends AbstractContainerScreen<BedrockifierG
|
||||
|
||||
guiGraphics.blit(new ResourceLocation("nims_random_bullshit:textures/screens/plus_sign.png"), this.leftPos + 42, this.topPos + 34, 0, 0, 16, 16, 16, 16);
|
||||
|
||||
guiGraphics.blit(new ResourceLocation("nims_random_bullshit:textures/screens/right_arrow_sign.png"), this.leftPos + 96, this.topPos + 34, 0, 0, 32, 16, 32, 16);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
@@ -73,13 +72,5 @@ public class BedrockifierGUIScreen extends AbstractContainerScreen<BedrockifierG
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
button_empty = Button.builder(Component.translatable("gui.nims_random_bullshit.bedrockifier_gui.button_empty"), e -> {
|
||||
if (true) {
|
||||
NimsRandomBullshitMod.PACKET_HANDLER.sendToServer(new BedrockifierGUIButtonMessage(0, x, y, z));
|
||||
BedrockifierGUIButtonMessage.handleButtonAction(entity, 0, x, y, z);
|
||||
}
|
||||
}).bounds(this.leftPos + 96, this.topPos + 34, 35, 20).build();
|
||||
guistate.put("button:button_empty", button_empty);
|
||||
this.addRenderableWidget(button_empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.client.gui;
|
||||
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -6,13 +7,10 @@ import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.OreMinerGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.procedures.OreMinerGUISlot0ImageDisplayConditionProcedure;
|
||||
import net.mcreator.nimsrandombullshit.network.OreMinerGUIButtonMessage;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -23,7 +21,6 @@ public class OreMinerGUIScreen extends AbstractContainerScreen<OreMinerGUIMenu>
|
||||
private final Level world;
|
||||
private final int x, y, z;
|
||||
private final Player entity;
|
||||
Button button_mine;
|
||||
|
||||
public OreMinerGUIScreen(OreMinerGUIMenu container, Inventory inventory, Component text) {
|
||||
super(container, inventory, text);
|
||||
@@ -73,13 +70,5 @@ public class OreMinerGUIScreen extends AbstractContainerScreen<OreMinerGUIMenu>
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
button_mine = Button.builder(Component.translatable("gui.nims_random_bullshit.ore_miner_gui.button_mine"), e -> {
|
||||
if (true) {
|
||||
NimsRandomBullshitMod.PACKET_HANDLER.sendToServer(new OreMinerGUIButtonMessage(0, x, y, z));
|
||||
OreMinerGUIButtonMessage.handleButtonAction(entity, 0, x, y, z);
|
||||
}
|
||||
}).bounds(this.leftPos + 15, this.topPos + 43, 46, 20).build();
|
||||
guistate.put("button:button_mine", button_mine);
|
||||
this.addRenderableWidget(button_mine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.client.gui;
|
||||
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.mcreator.nimsrandombullshit.item.BedrockUpgradeTemplateItem;
|
||||
import net.mcreator.nimsrandombullshit.item.BedrockSwordItem;
|
||||
import net.mcreator.nimsrandombullshit.item.BedrockShardItem;
|
||||
import net.mcreator.nimsrandombullshit.item.BedrockPickaxeItem;
|
||||
import net.mcreator.nimsrandombullshit.item.BedrockEaterItem;
|
||||
import net.mcreator.nimsrandombullshit.item.BeanItem;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
@@ -103,6 +104,7 @@ public class NimsRandomBullshitModItems {
|
||||
public static final RegistryObject<Item> ORICHALCUM_ARMOR_LEGGINGS = REGISTRY.register("orichalcum_armor_leggings", () -> new OrichalcumArmorItem.Leggings());
|
||||
public static final RegistryObject<Item> ORICHALCUM_ARMOR_BOOTS = REGISTRY.register("orichalcum_armor_boots", () -> new OrichalcumArmorItem.Boots());
|
||||
public static final RegistryObject<Item> BEDROCK_SHARD = REGISTRY.register("bedrock_shard", () -> new BedrockShardItem());
|
||||
public static final RegistryObject<Item> BEDROCK_EATER = REGISTRY.register("bedrock_eater", () -> new BedrockEaterItem());
|
||||
|
||||
// Start of user code block custom items
|
||||
// End of user code block custom items
|
||||
|
||||
@@ -7,18 +7,82 @@ package net.mcreator.nimsrandombullshit.init;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
||||
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.ShitGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.OreMinerGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.BedrockifierGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class NimsRandomBullshitModMenus {
|
||||
public static final DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.MENU_TYPES, NimsRandomBullshitMod.MODID);
|
||||
public static final RegistryObject<MenuType<ShitGUIMenu>> SHIT_GUI = REGISTRY.register("shit_gui", () -> IForgeMenuType.create(ShitGUIMenu::new));
|
||||
public static final RegistryObject<MenuType<OreMinerGUIMenu>> ORE_MINER_GUI = REGISTRY.register("ore_miner_gui", () -> IForgeMenuType.create(OreMinerGUIMenu::new));
|
||||
public static final RegistryObject<MenuType<BedrockifierGUIMenu>> BEDROCKIFIER_GUI = REGISTRY.register("bedrockifier_gui", () -> IForgeMenuType.create(BedrockifierGUIMenu::new));
|
||||
|
||||
public static void setText(String boxname, String value, @Nullable ServerPlayer player) {
|
||||
if (player != null) {
|
||||
NimsRandomBullshitMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new GuiSyncMessage(boxname, value));
|
||||
} else {
|
||||
NimsRandomBullshitMod.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new GuiSyncMessage(boxname, value));
|
||||
}
|
||||
}
|
||||
|
||||
public static class GuiSyncMessage {
|
||||
private final String textboxid;
|
||||
private final String data;
|
||||
|
||||
public GuiSyncMessage(FriendlyByteBuf buffer) {
|
||||
this.textboxid = buffer.readComponent().getString();
|
||||
this.data = buffer.readComponent().getString();
|
||||
}
|
||||
|
||||
public GuiSyncMessage(String textboxid, String data) {
|
||||
this.textboxid = textboxid;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static void buffer(GuiSyncMessage message, FriendlyByteBuf buffer) {
|
||||
buffer.writeComponent(Component.literal(message.textboxid));
|
||||
buffer.writeComponent(Component.literal(message.data));
|
||||
}
|
||||
|
||||
public static void handleData(GuiSyncMessage message, Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
NetworkEvent.Context context = contextSupplier.get();
|
||||
context.enqueueWork(() -> {
|
||||
if (!context.getDirection().getReceptionSide().isServer()) {
|
||||
NimsRandomBullshitModScreens.handleTextBoxMessage(message);
|
||||
}
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
||||
String editbox() {
|
||||
return this.textboxid;
|
||||
}
|
||||
|
||||
String value() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void init(FMLCommonSetupEvent event) {
|
||||
NimsRandomBullshitMod.addNetworkMessage(GuiSyncMessage.class, GuiSyncMessage::buffer, GuiSyncMessage::new, GuiSyncMessage::handleData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,18 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.MenuScreens;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModMenus.GuiSyncMessage;
|
||||
import net.mcreator.nimsrandombullshit.client.gui.ShitGUIScreen;
|
||||
import net.mcreator.nimsrandombullshit.client.gui.OreMinerGUIScreen;
|
||||
import net.mcreator.nimsrandombullshit.client.gui.BedrockifierGUIScreen;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public class NimsRandomBullshitModScreens {
|
||||
@SubscribeEvent
|
||||
@@ -25,4 +31,21 @@ public class NimsRandomBullshitModScreens {
|
||||
MenuScreens.register(NimsRandomBullshitModMenus.BEDROCKIFIER_GUI.get(), BedrockifierGUIScreen::new);
|
||||
});
|
||||
}
|
||||
|
||||
static void handleTextBoxMessage(GuiSyncMessage message) {
|
||||
String editbox = message.editbox();
|
||||
String value = message.value();
|
||||
Screen currentScreen = Minecraft.getInstance().screen;
|
||||
if (currentScreen instanceof WidgetScreen sc) {
|
||||
HashMap<String, Object> widgets = sc.getWidgets();
|
||||
Object obj = widgets.get("text:" + editbox);
|
||||
if (obj instanceof EditBox box) {
|
||||
box.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface WidgetScreen {
|
||||
HashMap<String, Object> getWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class NimsRandomBullshitModTabs {
|
||||
tabData.accept(NimsRandomBullshitModItems.ORICHALCUM_AXE.get());
|
||||
tabData.accept(NimsRandomBullshitModItems.ORICHALCUM_SHOVEL.get());
|
||||
tabData.accept(NimsRandomBullshitModItems.ORICHALCUM_HOE.get());
|
||||
tabData.accept(NimsRandomBullshitModItems.BEDROCK_EATER.get());
|
||||
} else if (tabData.getTabKey() == CreativeModeTabs.INGREDIENTS) {
|
||||
tabData.accept(NimsRandomBullshitModItems.NETHERRACKITE.get());
|
||||
tabData.accept(NimsRandomBullshitModItems.SAND_DUST.get());
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.item;
|
||||
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.procedures.BedrockEaterRightClickProcedure;
|
||||
|
||||
public class BedrockEaterItem extends Item {
|
||||
public BedrockEaterItem() {
|
||||
super(new Item.Properties().stacksTo(1).fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UseAnim getUseAnimation(ItemStack itemstack) {
|
||||
return UseAnim.BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
super.useOn(context);
|
||||
BedrockEaterRightClickProcedure.execute(context.getLevel(), context.getClickedPos().getX(), context.getClickedPos().getY(), context.getClickedPos().getZ(), context.getPlayer(), context.getItemInHand());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class BedrockPickaxeItem extends PickaxeItem {
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return 19;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BedrockSwordItem extends SwordItem {
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return 19;
|
||||
return 22;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.mcreator.nimsrandombullshit.procedures.BlockEaterRightclickedOnBlockP
|
||||
|
||||
public class BlockEaterItem extends Item {
|
||||
public BlockEaterItem() {
|
||||
super(new Item.Properties().stacksTo(1).rarity(Rarity.EPIC));
|
||||
super(new Item.Properties().stacksTo(1).fireResistant().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.network;
|
||||
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.BedrockifierGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.procedures.BedrockifierButtonPressLogicProcedure;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class BedrockifierGUIButtonMessage {
|
||||
private final int buttonID, x, y, z;
|
||||
|
||||
public BedrockifierGUIButtonMessage(FriendlyByteBuf buffer) {
|
||||
this.buttonID = buffer.readInt();
|
||||
this.x = buffer.readInt();
|
||||
this.y = buffer.readInt();
|
||||
this.z = buffer.readInt();
|
||||
}
|
||||
|
||||
public BedrockifierGUIButtonMessage(int buttonID, int x, int y, int z) {
|
||||
this.buttonID = buttonID;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static void buffer(BedrockifierGUIButtonMessage message, FriendlyByteBuf buffer) {
|
||||
buffer.writeInt(message.buttonID);
|
||||
buffer.writeInt(message.x);
|
||||
buffer.writeInt(message.y);
|
||||
buffer.writeInt(message.z);
|
||||
}
|
||||
|
||||
public static void handler(BedrockifierGUIButtonMessage message, Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
NetworkEvent.Context context = contextSupplier.get();
|
||||
context.enqueueWork(() -> {
|
||||
Player entity = context.getSender();
|
||||
int buttonID = message.buttonID;
|
||||
int x = message.x;
|
||||
int y = message.y;
|
||||
int z = message.z;
|
||||
handleButtonAction(entity, buttonID, x, y, z);
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
||||
public static void handleButtonAction(Player entity, int buttonID, int x, int y, int z) {
|
||||
Level world = entity.level();
|
||||
HashMap guistate = BedrockifierGUIMenu.guistate;
|
||||
// security measure to prevent arbitrary chunk generation
|
||||
if (!world.hasChunkAt(new BlockPos(x, y, z)))
|
||||
return;
|
||||
if (buttonID == 0) {
|
||||
|
||||
BedrockifierButtonPressLogicProcedure.execute(world, x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerMessage(FMLCommonSetupEvent event) {
|
||||
NimsRandomBullshitMod.addNetworkMessage(BedrockifierGUIButtonMessage.class, BedrockifierGUIButtonMessage::buffer, BedrockifierGUIButtonMessage::new, BedrockifierGUIButtonMessage::handler);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
package net.mcreator.nimsrandombullshit.network;
|
||||
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import net.mcreator.nimsrandombullshit.world.inventory.OreMinerGUIMenu;
|
||||
import net.mcreator.nimsrandombullshit.procedures.OreMinerMineButtonPressedProcedure;
|
||||
import net.mcreator.nimsrandombullshit.NimsRandomBullshitMod;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class OreMinerGUIButtonMessage {
|
||||
private final int buttonID, x, y, z;
|
||||
|
||||
public OreMinerGUIButtonMessage(FriendlyByteBuf buffer) {
|
||||
this.buttonID = buffer.readInt();
|
||||
this.x = buffer.readInt();
|
||||
this.y = buffer.readInt();
|
||||
this.z = buffer.readInt();
|
||||
}
|
||||
|
||||
public OreMinerGUIButtonMessage(int buttonID, int x, int y, int z) {
|
||||
this.buttonID = buttonID;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public static void buffer(OreMinerGUIButtonMessage message, FriendlyByteBuf buffer) {
|
||||
buffer.writeInt(message.buttonID);
|
||||
buffer.writeInt(message.x);
|
||||
buffer.writeInt(message.y);
|
||||
buffer.writeInt(message.z);
|
||||
}
|
||||
|
||||
public static void handler(OreMinerGUIButtonMessage message, Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
NetworkEvent.Context context = contextSupplier.get();
|
||||
context.enqueueWork(() -> {
|
||||
Player entity = context.getSender();
|
||||
int buttonID = message.buttonID;
|
||||
int x = message.x;
|
||||
int y = message.y;
|
||||
int z = message.z;
|
||||
handleButtonAction(entity, buttonID, x, y, z);
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
||||
public static void handleButtonAction(Player entity, int buttonID, int x, int y, int z) {
|
||||
Level world = entity.level();
|
||||
HashMap guistate = OreMinerGUIMenu.guistate;
|
||||
// security measure to prevent arbitrary chunk generation
|
||||
if (!world.hasChunkAt(new BlockPos(x, y, z)))
|
||||
return;
|
||||
if (buttonID == 0) {
|
||||
|
||||
OreMinerMineButtonPressedProcedure.execute(world, x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerMessage(FMLCommonSetupEvent event) {
|
||||
NimsRandomBullshitMod.addNetworkMessage(OreMinerGUIButtonMessage.class, OreMinerGUIButtonMessage::buffer, OreMinerGUIButtonMessage::new, OreMinerGUIButtonMessage::handler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.mcreator.nimsrandombullshit.procedures;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.advancements.AdvancementProgress;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
|
||||
public class BedrockEaterRightClickProcedure {
|
||||
public static void execute(LevelAccessor world, double x, double y, double z, Entity entity, ItemStack itemstack) {
|
||||
if (entity == null)
|
||||
return;
|
||||
if ((world.getBlockState(BlockPos.containing(x, y, z))).getBlock() == Blocks.BEDROCK || world.getBlockState(BlockPos.containing(x, y, z)).getDestroySpeed(world, BlockPos.containing(x, y, z)) != -1) {
|
||||
world.setBlock(BlockPos.containing(x, y, z), Blocks.AIR.defaultBlockState(), 3);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getFoodData().setFoodLevel((int) ((entity instanceof Player _plr ? _plr.getFoodData().getFoodLevel() : 0) + 6));
|
||||
if ((entity instanceof Player _plr ? _plr.getFoodData().getFoodLevel() : 0) >= 20) {
|
||||
if (entity instanceof Player _player)
|
||||
_player.getFoodData().setSaturation((float) ((entity instanceof Player _plr ? _plr.getFoodData().getSaturationLevel() : 0) + 3));
|
||||
}
|
||||
if (world instanceof Level _level) {
|
||||
if (!_level.isClientSide()) {
|
||||
_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.generic.eat")), SoundSource.PLAYERS, (float) 0.5, (float) 0.84);
|
||||
} else {
|
||||
_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.generic.eat")), SoundSource.PLAYERS, (float) 0.5, (float) 0.84, false);
|
||||
}
|
||||
}
|
||||
if (world instanceof ServerLevel _level)
|
||||
_level.sendParticles(ParticleTypes.END_ROD, x, y, z, 4, 1, 1, 1, 0.4);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns().addCooldown(itemstack.getItem(), 300);
|
||||
if (!(entity instanceof ServerPlayer _plr13 && _plr13.level() instanceof ServerLevel
|
||||
&& _plr13.getAdvancements().getOrStartProgress(_plr13.server.getAdvancements().getAdvancement(new ResourceLocation("nims_random_bullshit:block_eater_advancement"))).isDone())) {
|
||||
if (entity instanceof ServerPlayer _player) {
|
||||
Advancement _adv = _player.server.getAdvancements().getAdvancement(new ResourceLocation("nims_random_bullshit:block_eater_advancement"));
|
||||
AdvancementProgress _ap = _player.getAdvancements().getOrStartProgress(_adv);
|
||||
if (!_ap.isDone()) {
|
||||
for (String criteria : _ap.getRemainingCriteria())
|
||||
_player.getAdvancements().award(_adv, criteria);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package net.mcreator.nimsrandombullshit.procedures;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Map;
|
||||
|
||||
public class BedrockifierButtonPressLogicProcedure {
|
||||
public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
|
||||
if (entity == null)
|
||||
return;
|
||||
if (!world.isClientSide()) {
|
||||
if (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(0) > 0) {
|
||||
if ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getOrCreateTag()
|
||||
.getBoolean("Unbreakable") == false
|
||||
&& (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(1)).getItem() : ItemStack.EMPTY).getItem() == Blocks.BEDROCK.asItem()) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(2) + 1));
|
||||
((Slot) _slots.get(2)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(0) - 1));
|
||||
((Slot) _slots.get(0)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(1)).getItem() : ItemStack.EMPTY).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(1) - 1));
|
||||
((Slot) _slots.get(1)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
(entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(2)).getItem() : ItemStack.EMPTY).getOrCreateTag().putBoolean("Unbreakable",
|
||||
true);
|
||||
if (world instanceof Level _level) {
|
||||
if (!_level.isClientSide()) {
|
||||
_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.smithing_table.use")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8);
|
||||
} else {
|
||||
_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.smithing_table.use")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package net.mcreator.nimsrandombullshit.procedures;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class BedrockifierLogicProcedure {
|
||||
public static void execute(LevelAccessor world, double x, double y, double z) {
|
||||
ItemStack ResultItem = ItemStack.EMPTY;
|
||||
if (!world.isClientSide()) {
|
||||
if (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 0) > 0) {
|
||||
if ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getOrCreateTag().getBoolean("Unbreakable") == false && (new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 1)).getItem() == Blocks.BEDROCK.asItem()) {
|
||||
ResultItem = (new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).copy();
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 0;
|
||||
final ItemStack _setstack = (new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 0) - 1));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 1;
|
||||
final ItemStack _setstack = (new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 1)).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 1) - 1));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
ResultItem.getOrCreateTag().putBoolean("Unbreakable", true);
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 2;
|
||||
final ItemStack _setstack = ResultItem.copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 2) + 1));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (world instanceof Level _level) {
|
||||
if (!_level.isClientSide()) {
|
||||
_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.smithing_table.use")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8);
|
||||
} else {
|
||||
_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.smithing_table.use")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
package net.mcreator.nimsrandombullshit.procedures;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Map;
|
||||
|
||||
public class OreMinerMineButtonPressedProcedure {
|
||||
public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
|
||||
if (entity == null)
|
||||
return;
|
||||
double oreMinerRoll = 0;
|
||||
if (!world.isClientSide()) {
|
||||
if (!((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() == ItemStack.EMPTY.getItem())
|
||||
&& !(entity instanceof Player _plrCldCheck5 && _plrCldCheck5.getCooldowns()
|
||||
.isOnCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem()))) {
|
||||
if (world instanceof Level _level) {
|
||||
if (!_level.isClientSide()) {
|
||||
_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.amethyst_block.break")), SoundSource.BLOCKS, 1, (float) Mth.nextDouble(RandomSource.create(), 0.75, 0.85));
|
||||
} else {
|
||||
_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.amethyst_block.break")), SoundSource.BLOCKS, 1, (float) Mth.nextDouble(RandomSource.create(), 0.75, 0.85), false);
|
||||
}
|
||||
}
|
||||
{
|
||||
ItemStack _ist = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY);
|
||||
if (_ist.hurt(15, RandomSource.create(), null)) {
|
||||
_ist.shrink(1);
|
||||
_ist.setDamageValue(0);
|
||||
}
|
||||
}
|
||||
oreMinerRoll = Math.random();
|
||||
if (oreMinerRoll < 0.4) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.COAL).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(1) + Mth.nextInt(RandomSource.create(), 1, 3)
|
||||
* ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(1)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.giveExperiencePoints(1);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 6);
|
||||
} else if (oreMinerRoll < 0.6) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.COPPER_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(2) + Mth.nextInt(RandomSource.create(), 2, 4)
|
||||
* ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(2)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 8);
|
||||
} else if (oreMinerRoll < 0.7) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.IRON_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(3) + 1 * ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(3)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 8);
|
||||
} else if (oreMinerRoll < 0.78) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.GOLD_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(4) + 1 * ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(4)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 10);
|
||||
} else if (oreMinerRoll < 0.81) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.DIAMOND).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(5) + Mth.nextInt(RandomSource.create(), 1, 2)
|
||||
* ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(5)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.giveExperiencePoints(3);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 14);
|
||||
} else if (oreMinerRoll < 0.84) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.EMERALD).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(6) + Mth.nextInt(RandomSource.create(), 1, 2)
|
||||
* ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(6)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.giveExperiencePoints(3);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 14);
|
||||
} else if (oreMinerRoll < 0.985) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.REDSTONE).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(7) + Mth.nextInt(RandomSource.create(), 3, 6)
|
||||
* ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(7)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.giveExperiencePoints(5);
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 9);
|
||||
} else {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack _setstack = new ItemStack(Items.NETHERITE_SCRAP).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(int sltid) {
|
||||
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
|
||||
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
|
||||
if (stack != null)
|
||||
return stack.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}.getAmount(8) + 1 * ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
|
||||
.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
((Slot) _slots.get(8)).set(_setstack);
|
||||
_player.containerMenu.broadcastChanges();
|
||||
}
|
||||
if (entity instanceof Player _player)
|
||||
_player.getCooldowns()
|
||||
.addCooldown((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem(), 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package net.mcreator.nimsrandombullshit.procedures;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class OreMinerTickUpdateProcedure {
|
||||
public static void execute(LevelAccessor world, double x, double y, double z) {
|
||||
double oreMinerRoll = 0;
|
||||
if (!world.isClientSide()) {
|
||||
if (!((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getItem() == ItemStack.EMPTY.getItem())) {
|
||||
if (world instanceof Level _level) {
|
||||
if (!_level.isClientSide()) {
|
||||
_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.amethyst_block.break")), SoundSource.BLOCKS, (float) 0.6,
|
||||
(float) Mth.nextDouble(RandomSource.create(), 0.75, 0.85));
|
||||
} else {
|
||||
_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.amethyst_block.break")), SoundSource.BLOCKS, (float) 0.6, (float) Mth.nextDouble(RandomSource.create(), 0.75, 0.85), false);
|
||||
}
|
||||
}
|
||||
{
|
||||
ItemStack _ist = (new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0));
|
||||
if (_ist.hurt(15, RandomSource.create(), null)) {
|
||||
_ist.shrink(1);
|
||||
_ist.setDamageValue(0);
|
||||
}
|
||||
}
|
||||
oreMinerRoll = Math.random();
|
||||
if (oreMinerRoll < 0.4) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 1;
|
||||
final ItemStack _setstack = new ItemStack(Items.COAL).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 1) + Mth.nextInt(RandomSource.create(), 1, 3) * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.6) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 2;
|
||||
final ItemStack _setstack = new ItemStack(Items.COPPER_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 2) + Mth.nextInt(RandomSource.create(), 2, 4) * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.7) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 3;
|
||||
final ItemStack _setstack = new ItemStack(Items.IRON_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 3) + 1 * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.78) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 4;
|
||||
final ItemStack _setstack = new ItemStack(Items.GOLD_INGOT).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 4) + 1 * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.81) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 5;
|
||||
final ItemStack _setstack = new ItemStack(Items.DIAMOND).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 5) + Mth.nextInt(RandomSource.create(), 1, 2) * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.84) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 6;
|
||||
final ItemStack _setstack = new ItemStack(Items.EMERALD).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 6) + Mth.nextInt(RandomSource.create(), 1, 2) * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (oreMinerRoll < 0.985) {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 7;
|
||||
final ItemStack _setstack = new ItemStack(Items.REDSTONE).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 7) + Mth.nextInt(RandomSource.create(), 3, 6) * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
{
|
||||
BlockEntity _ent = world.getBlockEntity(BlockPos.containing(x, y, z));
|
||||
if (_ent != null) {
|
||||
final int _slotid = 8;
|
||||
final ItemStack _setstack = new ItemStack(Items.NETHERITE_SCRAP).copy();
|
||||
_setstack.setCount((int) (new Object() {
|
||||
public int getAmount(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicInteger _retval = new AtomicInteger(0);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).getCount()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getAmount(world, BlockPos.containing(x, y, z), 8) + 1 * ((new Object() {
|
||||
public ItemStack getItemStack(LevelAccessor world, BlockPos pos, int slotid) {
|
||||
AtomicReference<ItemStack> _retval = new AtomicReference<>(ItemStack.EMPTY);
|
||||
BlockEntity _ent = world.getBlockEntity(pos);
|
||||
if (_ent != null)
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> _retval.set(capability.getStackInSlot(slotid).copy()));
|
||||
return _retval.get();
|
||||
}
|
||||
}.getItemStack(world, BlockPos.containing(x, y, z), 0)).getEnchantmentLevel(Enchantments.BLOCK_FORTUNE) + 1)));
|
||||
_ent.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(capability -> {
|
||||
if (capability instanceof IItemHandlerModifiable)
|
||||
((IItemHandlerModifiable) capability).setStackInSlot(_slotid, _setstack);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,13 +80,9 @@ public class BedrockifierGUIMenu extends AbstractContainerMenu implements Suppli
|
||||
}
|
||||
this.customSlots.put(0, this.addSlot(new SlotItemHandler(internal, 0, 16, 35) {
|
||||
private final int slot = 0;
|
||||
private int x = BedrockifierGUIMenu.this.x;
|
||||
private int y = BedrockifierGUIMenu.this.y;
|
||||
}));
|
||||
this.customSlots.put(1, this.addSlot(new SlotItemHandler(internal, 1, 70, 35) {
|
||||
private final int slot = 1;
|
||||
private int x = BedrockifierGUIMenu.this.x;
|
||||
private int y = BedrockifierGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -95,8 +91,6 @@ public class BedrockifierGUIMenu extends AbstractContainerMenu implements Suppli
|
||||
}));
|
||||
this.customSlots.put(2, this.addSlot(new SlotItemHandler(internal, 2, 142, 35) {
|
||||
private final int slot = 2;
|
||||
private int x = BedrockifierGUIMenu.this.x;
|
||||
private int y = BedrockifierGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
|
||||
@@ -81,8 +81,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}
|
||||
this.customSlots.put(0, this.addSlot(new SlotItemHandler(internal, 0, 31, 17) {
|
||||
private final int slot = 0;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -91,8 +89,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(1, this.addSlot(new SlotItemHandler(internal, 1, 79, 17) {
|
||||
private final int slot = 1;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -101,8 +97,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(2, this.addSlot(new SlotItemHandler(internal, 2, 97, 17) {
|
||||
private final int slot = 2;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -111,8 +105,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(3, this.addSlot(new SlotItemHandler(internal, 3, 115, 17) {
|
||||
private final int slot = 3;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -121,8 +113,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(4, this.addSlot(new SlotItemHandler(internal, 4, 133, 17) {
|
||||
private final int slot = 4;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -131,8 +121,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(5, this.addSlot(new SlotItemHandler(internal, 5, 79, 35) {
|
||||
private final int slot = 5;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -141,8 +129,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(6, this.addSlot(new SlotItemHandler(internal, 6, 97, 35) {
|
||||
private final int slot = 6;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -151,8 +137,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(7, this.addSlot(new SlotItemHandler(internal, 7, 115, 35) {
|
||||
private final int slot = 7;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
@@ -161,8 +145,6 @@ public class OreMinerGUIMenu extends AbstractContainerMenu implements Supplier<M
|
||||
}));
|
||||
this.customSlots.put(8, this.addSlot(new SlotItemHandler(internal, 8, 133, 35) {
|
||||
private final int slot = 8;
|
||||
private int x = OreMinerGUIMenu.this.x;
|
||||
private int y = OreMinerGUIMenu.this.y;
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
|
||||
@@ -4,7 +4,7 @@ license="Academic Free License v3.0"
|
||||
|
||||
[[mods]]
|
||||
modId="nims_random_bullshit"
|
||||
version="1.7.0"
|
||||
version="1.7.1"
|
||||
displayName="Nim's Random Bullshit"
|
||||
displayURL="https://mcreator.net"
|
||||
logoFile="logo.png"
|
||||
@@ -23,6 +23,18 @@ description="Random shit added by Nim. Created with MCreator."
|
||||
side="BOTH"
|
||||
|
||||
|
||||
[[dependencies.nims_random_bullshit]]
|
||||
modId="photon"
|
||||
mandatory=false
|
||||
versionRange="[0,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.nims_random_bullshit]]
|
||||
modId="pehkui"
|
||||
mandatory=false
|
||||
versionRange="[0,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
|
||||
# Start of user code block dependencies configuration
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
"item.nims_random_bullshit.netherrack_juice_bucket": "Netherrack Juice Bucket",
|
||||
"item.nims_random_bullshit.orichalcum": "Orichalcum",
|
||||
"advancements.magic_egg_advancement.descr": "Obtain a Magic Egg",
|
||||
"item.nims_random_bullshit.bedrock_eater": "Bedrock Eater",
|
||||
"block.nims_random_bullshit.rubber_pressure_plate": "Rubber Pressure Plate",
|
||||
"item.nims_random_bullshit.orichalcum_armor_leggings": "Orichalcum Leggings",
|
||||
"block.nims_random_bullshit.condensed_netherrack": "Condensed Netherrack",
|
||||
|
||||
|
Before Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 437 B |
|
Before Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 313 B |
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"pattern": [
|
||||
"ab",
|
||||
"bb"
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "nims_random_bullshit:block_eater"
|
||||
},
|
||||
"b": {
|
||||
"item": "minecraft:bedrock"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "nims_random_bullshit:bedrock_eater",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
"item": "minecraft:netherite_scrap"
|
||||
},
|
||||
{
|
||||
"item": "nims_random_bullshit:quadra_condensed_netherrack"
|
||||
"item": "minecraft:bedrock"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:gold_ingot"
|
||||
|
||||