• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Why are you not using a TileEntity for this?
    • Dear Modding Community,   I'm working on an Wireless Redstone Modification, I am using WorldSaveData to save the Receiver and Transmitter Blocks, but the Power Output of my Receiver Block doesn't change. What is wrong?   Thanks in advance Aaron   RedstoneReceiverList: public class RedstoneReceiverList extends WorldSavedData { private static RedstoneReceiverList clientInstance = new RedstoneReceiverList(); public final HashMap<BlockPos, String> receiver = new HashMap<>(); public static final String RECEIVER_ID = BetterRedstone.MOD_ID + "_RECEIVER"; public static RedstoneReceiverList get(World w) { if(!w.isRemote) { DimensionSavedDataManager storage = ((ServerWorld) w).getSavedData(); return storage.getOrCreate(RedstoneReceiverList::new, RECEIVER_ID); }else { return clientInstance; } } public RedstoneReceiverList() { super(RECEIVER_ID); } public RedstoneReceiverList(String id) { super(id); } @Override public void read(@Nonnull CompoundNBT nbt) { this.receiver.clear(); if(nbt.contains("receiver", Constants.NBT.TAG_LIST)) { ListNBT list = nbt.getList("receiver", Constants.NBT.TAG_COMPOUND); for(int i = 0; i < list.size(); i++) { CompoundNBT entryNBT = list.getCompound(i); if(entryNBT.contains("x") && entryNBT.contains("y") && entryNBT.contains("z") && entryNBT.contains("id")) { BlockPos pos = new BlockPos(entryNBT.getInt("x"), entryNBT.getInt("y"), entryNBT.getInt("z")).toImmutable(); String id = entryNBT.getString("id"); if(!id.isEmpty()) { this.receiver.put(pos, entryNBT.getString("id")); } } } } } @Override public CompoundNBT write(CompoundNBT nbt) { ListNBT list = new ListNBT(); for(Map.Entry<BlockPos, String> entry : this.receiver.entrySet()) { CompoundNBT entryNBT = new CompoundNBT(); entryNBT.putInt("x", entry.getKey().getX()); entryNBT.putInt("y", entry.getKey().getY()); entryNBT.putInt("z", entry.getKey().getZ()); entryNBT.putString("id", entry.getValue()); list.add(entryNBT); } nbt.put("receiver", list); return nbt; } public void setReceiver(World w, BlockPos pos, @Nullable String id) { if(!w.isRemote) { BlockPos immutablePos = pos.toImmutable(); if(id == null || id.trim().isEmpty()) { if(this.receiver.containsKey(immutablePos)) { this.receiver.remove(immutablePos); } }else{ String oldID = this.receiver.getOrDefault(immutablePos, null); if(oldID == null || !oldID.equals(id)) { this.receiver.put(pos.toImmutable(), id); } } this.markDirty(); } } public String getReceiver(BlockPos pos) { return this.receiver.getOrDefault(pos.toImmutable(), null); } }   RedstoneTransmitterList: public class RedstoneTransmitterList extends WorldSavedData { private static RedstoneTransmitterList clientInstance = new RedstoneTransmitterList(); public final HashMap<BlockPos, String> transmitter = new HashMap<>(); public static final String TRANSMITTER_ID = BetterRedstone.MOD_ID + "_TRANSMITTER"; public static RedstoneTransmitterList get(World w) { if(!w.isRemote) { DimensionSavedDataManager storage = ((ServerWorld) w).getSavedData(); return storage.getOrCreate(RedstoneTransmitterList::new, TRANSMITTER_ID); }else { return clientInstance; } } public RedstoneTransmitterList() { super(TRANSMITTER_ID); } public RedstoneTransmitterList(String id) { super(id); } @Override public void read(@Nonnull CompoundNBT nbt) { this.transmitter.clear(); if(nbt.contains("transmitter", Constants.NBT.TAG_LIST)) { ListNBT list = nbt.getList("transmitter", Constants.NBT.TAG_COMPOUND); for(int i = 0; i < list.size(); i++) { CompoundNBT entryNBT = list.getCompound(i); if(entryNBT.contains("x") && entryNBT.contains("y") && entryNBT.contains("z") && entryNBT.contains("id")) { BlockPos pos = new BlockPos(entryNBT.getInt("x"), entryNBT.getInt("y"), entryNBT.getInt("z")).toImmutable(); String id = entryNBT.getString("id"); if(!id.isEmpty()) { this.transmitter.put(pos, entryNBT.getString("id")); } } } } } @Override public CompoundNBT write(CompoundNBT nbt) { ListNBT list = new ListNBT(); for(Map.Entry<BlockPos, String> entry : this.transmitter.entrySet()) { CompoundNBT entryNBT = new CompoundNBT(); entryNBT.putInt("x", entry.getKey().getX()); entryNBT.putInt("y", entry.getKey().getY()); entryNBT.putInt("z", entry.getKey().getZ()); entryNBT.putString("id", entry.getValue()); list.add(entryNBT); } nbt.put("transmitter", list); return nbt; } public void setTransmitter(World w, BlockPos pos, @Nullable String id) { if(!w.isRemote) { BlockPos immutablePos = pos.toImmutable(); if(id == null || id.trim().isEmpty()) { if(this.transmitter.containsKey(immutablePos)) { this.transmitter.remove(immutablePos); } }else{ String oldID = this.transmitter.getOrDefault(immutablePos, null); if(oldID == null || !oldID.equals(id)) { this.transmitter.put(pos.toImmutable(), id); } } this.markDirty(); } } public String getTransmitter(BlockPos pos) { return this.transmitter.getOrDefault(pos.toImmutable(), null); } }   RedstoneReceiverBlock: public class RedstoneReceiverBlock extends Block { public static final IntegerProperty ID = IntegerProperty.create("id", 0, 99); int power = 0; public RedstoneReceiverBlock() { super(AbstractBlock.Properties.create(Material.IRON, MaterialColor.EMERALD)); this.setDefaultState(this.getStateContainer().getBaseState().with(ID, 0)); } @Override public boolean canProvidePower(BlockState state) { return true; } @Override public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) { return true; } @Override public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) { return power; } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(ID); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); RedstoneReceiverList.get(worldIn).setReceiver(worldIn, pos, state.getValues().get(ID).toString()); BlockPos blockPos = getSingleKeyFromValue(RedstoneTransmitterList.get(worldIn).transmitter, state.getValues().get(ID).toString()); if(RedstoneUtil.isPowered(worldIn, blockPos)) { power = 15; }else{ power = 0; } } @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { super.onReplaced(state, worldIn, pos, newState, isMoving); RedstoneReceiverList.get(worldIn).setReceiver(worldIn, pos, null); } public static <K, V> K getSingleKeyFromValue(Map<K, V> map, V value) { for (Map.Entry<K, V> entry : map.entrySet()) { if (Objects.equals(value, entry.getValue())) { return entry.getKey(); } } return null; } }   RedstoneTransmitterBlock: public class RedstoneTransmitterBlock extends LeverBlock { public static final IntegerProperty ID = IntegerProperty.create("id", 0, 99); public RedstoneTransmitterBlock() { super(AbstractBlock.Properties.create(Material.IRON, MaterialColor.EMERALD)); this.setDefaultState(this.getStateContainer().getBaseState().with(ID, 0)); } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(ID, FACE, HORIZONTAL_FACING, POWERED); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); RedstoneTransmitterList.get(worldIn).setTransmitter(worldIn, pos, state.getValues().get(ID).toString()); } @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { super.onReplaced(state, worldIn, pos, newState, isMoving); RedstoneTransmitterList.get(worldIn).setTransmitter(worldIn, pos, null); } }  
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Ive tried to disable Foamfix but im not exactly sure where it is like thers a file in config called foam fix with the next info:  # Configuration file   client {     # Clears caches on world unload a bit faster than usual. Prevents temporary memory leaks. More effective in Anarchy. [default: true]     B:clearCachesOnWorldUnload=true       # Clears the baked models generated in the first pass *before* entering the second pass, instead of *after*. While this doesn't reduce memory usage in-game, it does reduce it noticeably during loading. [default: true]     B:clearDuplicateModelRegistry=true       # Deduplicates IModels too. Takes a few seconds more, but shaves off another bit of RAM. [default: true]     B:deduplicateModelBakers=true       # Deduplicates baked models. The original feature. [default: true]     B:deduplicateModels=true       # The maximum amount of levels of recursion for the deduplication process. Smaller values will deduplicate less data, but make the process run faster. [default: 9, range: 1-2147483647]     I:deduplicateModelsMaxRecursion=9       # Disables texture animations. [default: false]     B:disableTextureAnimations=false       # Initialize the options.txt and forge.cfg files with rendering performance-friendly defaults if not present. [default: true]     B:initOptions=true       # Makes vanilla creative tab search use JEI's lookups - saves a lot of RAM *and* gives you fancy JEI features! [default: true]     B:jeiCreativeSearch=true       # Remove unnecessary data from a pointlessly cached ModelLoader instance. [default: true]     B:modelLoaderCleanup=true       # Wipes the IModel cache after baking is finished. Saves a lot of RAM, as most IModels will not be reloaded. [default: true]     B:wipeModelCache=true }     coremod {     # Stops certain non-Minecraft-related libraries from being ASM transformed. You shouldn't be transforming those anyway. [default: true]     B:blacklistLibraryTransformers=true       # Make 3D forms of items be rendered dynamically and cached when necessary. [default: true]     B:dynamicItemModels=true       # Optimizes ItemStack.isEmpty by removing a map lookup. Initially found by Aikar (Paper/0181). [default: true]     B:fasterAirItemLookup=true       # Speeds up entity lookup by optimizing ClassInheritanceMultiMap.getByClass. [default: true]     B:fasterEntityLookup=true       # Speeds up the hopper's calculations. [default: true]     B:fasterHopper=true       # Optimizes blockstate property equals and hashCode methods. [default: true]     B:fasterPropertyComparisons=true       # Fixes the server not removing unloaded entities/tile entities if no chunkloaders are active. Thanks to CreativeMD for finding this! [default: true]     B:fixWorldEntityCleanup=true       # Disables all coremod functionality. [default: false]     B:forceDisable=false       # The amount of ticks per player presence check for mob spawners. Set to 1 to disable the patch and match vanilla behaviour. [default: 10, range: 1-200]     I:mobSpawnerCheckSpeed=10       # Optimizes BlockPos mutable/immutable getters to run on the same variables, letting them be inlined and thus theoretically increasing performance. [default: true]     B:optimizedBlockPos=true       # Fix a bug in chunk serialization leading to crashes. Originally found and fixed by Aaron1011 of Sponge. [default: true]     B:patchChunkSerialization=true       # Replaces the default BlockState/ExtendedBlockState implementations with a far more memory-efficient variant. [default: true]     B:smallPropertyStorage=true }     debug {     # Should FoamFix count and list baked models during deduplication, per mod? [default: false]     B:countListBakedModels=false }     experimental {     # Optimizes the backing map for EntityDataManager, saving memory *and* CPU time! May cause issues, however - please test and report back! [default: false]     B:fasterEntityDataManager=false       # Unpacks all baked quads. Increases RAM usage, but might speed some things up. [default: false]     B:unpackBakedQuads=false }     general {     # Enable deduplication of redundant objects in memory. [default: true]     B:deduplicate=true }     ghostbuster {     # Checks if worlds do not unload after a specified amount of time, and notifies the user if that is the case. [default: true]     B:checkNonUnloadedWorldClients=true       # The amount of time FoamFix should wait for a world to be deemed non-unloaded. [default: 60, range: 10-3600]     I:checkNonUnloadedWorldTimeout=60       # Wrap ChunkProviderServers to be able to provide the /ghostbuster command for debugging ghost chunkloads. [default: false]     B:enableDebuggingWrapper=false       # For FoamFix debugging/development purposes only. [default: false]     B:nonUnloadedWorldsForceGCOnCheck=false       # Should beds be prevented from ghost chunkloading? [default: true]     B:patchBeds=true       # Should the /ghostbuster debugger show neighbor updates? [default: false]     B:wrapperShowsNeighborUpdates=false }     launchwrapper {     # Remove Launchwrapper package manifest map (which is not used anyway). [default: true]     B:removePackageManifestMap=true       # Weaken LaunchWrapper's byte[] resource cache to make it cleanuppable by the GC. Safe. [default: true]     B:weakenResourceCache=true }     textures {     # If false, disables any patches from this category. [default: true]     B:enable=true       # Controls the faster animation path. 0 - disable, 2 - force enable, 1 (default) - enable on devices which have been shown to benefit from it. [default: 1, range: 0-2]     I:fasterAnimation=1       # The maximum amount of frames an animation can have for it to be cached. If you have a lot of VRAM, set higher. [default: 256, range: 0-2147483647]     I:maxAnimationFramesForCache=256       # Set to a number to disable animation updates past that mip level. -1 means update all. Higher numbers update more levels. To disable animation updates altogether, use the option for it. [default: -1, range: -1-4]     I:maxAnimationMipLevel=-1 }     tweaks {     # Prevent redstone from causing light updates by removing its light level. [default: false]     B:disableRedstoneLight=false       # Do not delay lighting updates over other types of updates. [default: false]     B:immediateLightingUpdates=false }
    • Looks like a problem with Quark. Make sure it is up to date, talk to the author if it already is.
  • Topics

  • Who's Online (See full list)